I am using the following code 'DeskTopIcon'(Code not mine) runs
when 'Workbook_Open' runs (Shown). It sets an icon as a shortcut on
the desk top when the file is opened. The message box part of code
tells the user it is there - this is good. Unfortunately it tells
the user it is there every time it opens. I wish it to not run when
the desk top icon has been set. I have tried the 'If' code noted
in 'Private Sub Workbook_Open()'- like a lot of things I try it
doesn't work.
So thank you in advance for whatever help you may give me.
Private Sub Workbook_Open()
'If Application.names("DeskTopIcon").value = "=TRUE" Then
'Exit Sub
'End If
'Application.names("DeskTopIcon").value = "=TRUE"
Application.Run ("DeskTopIcon")
End Sub
Sub DeskTopIcon()
'This code sets a shortcut on the desktop for the active workbook.
Dim WSHShell As Object
Dim MyShortcut As Object
Dim DesktopPath As String
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\" &
ActiveWorkbook.Name & ".lnk")
With MyShortcut
.TargetPath = ActiveWorkbook.FullName
.Save
End With
Set WSHShell = Nothing
MsgBox "A shortcut has been placed on your desktop for ' " &
ActiveWorkbook.Name & " '"
End Sub