Troubles with Windows Script Host

C

Chris Green

I'm trying to create shortcuts using WSH. When it sets the target, I get an
"Invalid Procedure Call" error. This happens whether or not the target is
hard-coded and with both early and late binding. I know it's creating the
shortcut object because it's showing up in the watches. Here's a sample.

Dim wshShell As Object
Dim wshShortcut As Object

Set wshShell = CreateObject("WScript.Shell")

Set wshShortcut = wshShell.CreateShortcut("C:\Temp\Short.lnk")
With wshShortcut
.TargetPath = "Test.doc"
.Save
End With


Thanks,

Chris
 
C

Chris Green

Dim wshShell As Object
Dim wshShortcut As Object

Set wshShell = CreateObject("WScript.Shell")

Set wshShortcut = wshShell.CreateShortcut("C:\Temp\Short.lnk")
With wshShortcut
.TargetPath = "Test.doc"
.Save
End With


Hmmm. It works fine if I specify a drive, as in .TargetPath =
"C:\Temp\Test.doc." The problem is that I don't want to fully qualify the
path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top