Rob4077
asked on
Create Desktop Shortcut
I would like to create a VBA module that will create a desktop shortcut that will launch my application: "C:\MyApp.mdb" , name the shortcut "My Application" and use the file "C:\MyApp.bmp" as the icon for the desktop shortcut. I have found the following module on another question on EE but cannot get it to work. Can anyone help me achieve what I need?
Private Sub Form_Load()
'... do whatever you're doing already here
Dim icon As String
'Change "house.ico" to whatever your icon is... if you wanted you could
'name the icon the same as the .mdb file and then just autoload it like this:
'icon = Application.CurrentProject .FullName & ".ico" 'looks for c:\path\to\my.mdb.ico
icon = Application.CurrentProject .Path & "\house.ico"
Dim dbs As Database
Set dbs = CurrentDb()
On Error Resume Next
If dbs.Properties("AppIcon") Is Nothing Then
' Create property if necessary.
Dim prp As Property
Set prp = dbs.CreateProperty("AppIco n", dbText, icon)
dbs.Properties.Append prp
Set prp = Nothing
Else
' Property already exists, just save new value.
dbs.Properties("AppIcon"). Value = icon
End If
Application.RefreshTitleBa r
Application.RefreshDatabas eWindow
Private Sub Form_Load()
'... do whatever you're doing already here
Dim icon As String
'Change "house.ico" to whatever your icon is... if you wanted you could
'name the icon the same as the .mdb file and then just autoload it like this:
'icon = Application.CurrentProject
icon = Application.CurrentProject
Dim dbs As Database
Set dbs = CurrentDb()
On Error Resume Next
If dbs.Properties("AppIcon") Is Nothing Then
' Create property if necessary.
Dim prp As Property
Set prp = dbs.CreateProperty("AppIco
dbs.Properties.Append prp
Set prp = Nothing
Else
' Property already exists, just save new value.
dbs.Properties("AppIcon").
End If
Application.RefreshTitleBa
Application.RefreshDatabas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to hear it worked for you. If you are all set, please accept my post so we can close this one down and move on :-)
Steve
Steve
ASKER
Sorry for the delay - forgot.
ASKER