Export Picture

S

Sean

This may seem a little strange, but to me it makes sense. I have a custom install program built in a workbook that will install that workbook and create all the folders it needs (the file is basically a program). I have set it up to creat desktop icons as well as links in the start menu. I also know how to modify the code to assign a picture as the icon. What my issue is, I would like the whole program to be self contained. What I would like to do is store the icon pictures in the workbook and when the workbook is installed, have code that creates icon files from those pistures that I can save and then link to

I have been searching google for the last couple hours and have come up with nothing. Is this even possible, if so, can someone point me in the right direction
 
M

Michel Pierron

Hi Sean;
You can test this:
To place your icon in a control image on a userform and recover the ico file by
means of the routine:

Sub SaveIcoFile()
Dim IcoFile As String
IcoFile = ThisWorkbook.Path & "\MyIcon.ico"
SavePicture UserForm1.Image1.Picture, IcoFile
End Sub

and after, create the shortcut:

Sub CreateLink()
With CreateObject("WScript.Shell")
With .CreateShortcut(.SpecialFolders("Desktop") & "\MyProg.lnk")
.TargetPath = ThisWorkbook.Path & "\MyBook.xls"
.WindowStyle = 1
.Hotkey = "CTRL+SHIFT+M"
.IconLocation = ThisWorkbook.Path & "\MyIcon.ico, 0"
.Description = "As you want"
.WorkingDirectory = ThisWorkbook.Path
.Save
End With
End With
End Sub

MP

Sean said:
This may seem a little strange, but to me it makes sense. I have a custom
install program built in a workbook that will install that workbook and create all
the folders it needs (the file is basically a program). I have set it up to creat
desktop icons as well as links in the start menu. I also know how to modify the
code to assign a picture as the icon. What my issue is, I would like the whole
program to be self contained. What I would like to do is store the icon pictures
in the workbook and when the workbook is installed, have code that creates icon
files from those pistures that I can save and then link to.
I have been searching google for the last couple hours and have come up with
nothing. Is this even possible, if so, can someone point me in the right
direction
 
Top