Never mind! I should have Googled the NG ~before~ posting!! As usual, the
experts have resolved this already, and I am behind the curve!
Ed
> I'm attempting to use Wscript.Shell through Word 2002 VBA to access a
> shortcut's TargetPath. Actually, right now I'm just attempting to set an
[quoted text clipped - 13 lines]
>
> End Sub
Hi Ed,
>Set WshShell = Wscript.CreateObject("Wscript.Shell") ' ???
Sub GetDesktop()
Dim WshShell As Object
Set WshShell = CreateObject("Wscript.Shell")
MsgBox "Your desktop is " & WshShell.SpecialFolders("Desktop")
Set WshShell = Nothing
End Sub
Dim WshShell As Object <<<
is some kind of a compromise,
as I could find the right type in the intellisense.
Maybe there isn't one at all.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Ed - 10 May 2006 19:01 GMT
Hi, Helmut. I was scanning lots of programming web sites to come up with
what I originally posted. I think I might have been trying to use something
other than VBA in my macro! Using some hints I found in a Word.VBA NG post,
I put together the following. It works for me in Windows XP with Word 2002.
Ed
Sub TryAgain2()
Dim strName As String
' Requires a reference to Windows Script Host Object Model
Dim objShell As IWshRuntimeLibrary.WshShell
Dim objLink As WshShortcut
' Requires a reference to Microsoft Scripting Runtime Library
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
' Get UserName
UName = Environ$("Username")
' Set folder path
MyPath = "C:\Documents and Settings\" & _
UName & "\Recent\"
' Get files
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(MyPath)
If Not objFolder Is Nothing Then
For Each objFile In objFolder.Files
With objFile
strName = objFile.Name
Set objShell = New IWshRuntimeLibrary.WshShell
Set objLink = objShell.CreateShortcut(MyPath & strName)
Debug.Print objLink.TargetPath
End With
Next objFile
End If
Set objLink = Nothing
Set objShell = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
End Sub
> Hi Ed,
>
[quoted text clipped - 12 lines]
> as I could find the right type in the intellisense.
> Maybe there isn't one at all.