B
bluejackethive72
I need to find the target path of a macro shortcut that is placed in Word's
startup directory. I used the below code in Word97 and Word2000 and both of
these versions the shortcut file was found and the target path and filename
were returned in .FoundFiles. I run the same code on Word2002 and Word2003
and it find the shortcut file but in .FoundFiles array the file that is
returned here is the path and filename of the shortcut which is the startup
directory not the target path.
Does anyone know what has changed in Word2002 and Word2003 versions? Is
there a different way to find the target path of a shortcut in the newest
Word versions?
Dim myShortcut As String
Dim myTemplate As String
myShortcut = Application.StartupPath & "\ShortcutCaption.*"
myTemplate = ""
With Application.FileSearch
.NewSearch
.SearchSubFolders = False
.FileName = myShortcut
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute = 1 Then myTemplate = .FoundFiles(1)
End With
If Len(myTemplate) = 0 Then
MsgBox "This shortcut or its target has been moved or renamed."
Exit Sub
End If
startup directory. I used the below code in Word97 and Word2000 and both of
these versions the shortcut file was found and the target path and filename
were returned in .FoundFiles. I run the same code on Word2002 and Word2003
and it find the shortcut file but in .FoundFiles array the file that is
returned here is the path and filename of the shortcut which is the startup
directory not the target path.
Does anyone know what has changed in Word2002 and Word2003 versions? Is
there a different way to find the target path of a shortcut in the newest
Word versions?
Dim myShortcut As String
Dim myTemplate As String
myShortcut = Application.StartupPath & "\ShortcutCaption.*"
myTemplate = ""
With Application.FileSearch
.NewSearch
.SearchSubFolders = False
.FileName = myShortcut
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute = 1 Then myTemplate = .FoundFiles(1)
End With
If Len(myTemplate) = 0 Then
MsgBox "This shortcut or its target has been moved or renamed."
Exit Sub
End If