rrenis
02-12-2008, 04:15 AM
Hi - I found this peice of code that works great when returning the path of a shortcut that is located in a 'SpecialFolder' such as the desktop. The problem is that I need it to point at a non 'SpecialFolder' i.e. C:\Temp and return the path of a selected shortcut in that directory. I'm having trouble altering this code to work when the shortcut "My Project" is located in C:\Temp instead of the Desktop. :think:
Public Sub Tester()
Dim WSHShell As Object
Dim MyShortcut As Object
Dim sDesktoPath As String
Dim sShortcutName As String
sShortcutName = "My Project"
Set WSHShell = CreateObject("WScript.Shell")
sDesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(sDesktopPath & "\" & sShortcutName & ".lnk")
MsgBox MyShortcut.TargetPath
Set WSHShell = Nothing
Set MyShortcut = Nothing
End Sub
Any help would be greatly appreciated!
cheers,
rrenis
Public Sub Tester()
Dim WSHShell As Object
Dim MyShortcut As Object
Dim sDesktoPath As String
Dim sShortcutName As String
sShortcutName = "My Project"
Set WSHShell = CreateObject("WScript.Shell")
sDesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(sDesktopPath & "\" & sShortcutName & ".lnk")
MsgBox MyShortcut.TargetPath
Set WSHShell = Nothing
Set MyShortcut = Nothing
End Sub
Any help would be greatly appreciated!
cheers,
rrenis