Why does hyperlink fail?

T

Terry Pinnell

Using Excel 2000 (under Windows XP) I cannot get a hyperlink of the form
ProgramXYZ.exe FileToOpen.ext
to work. It fails with the rather unhelpful message "An unexpected error
has occurred."

I've tried several simple examples, such as:
notepad.exe C:\Test.txt
or
C:\windows notepad.exe C:\Test.txt
but all fail. They work fine as normal shortcuts or in the Run box.

Anyone have any insights into this please? Or how to work around it?
 
J

James Ravenswood

Using Excel 2000 (under Windows XP) I cannot get a hyperlink of the form
ProgramXYZ.exe FileToOpen.ext
to work. It fails with the rather unhelpful message "An unexpected error
has occurred."

I've tried several simple examples, such as:
notepad.exe C:\Test.txt
or
C:\windows notepad.exe C:\Test.txt
but all fail. They work fine as normal shortcuts or in the Run box.

Anyone have any insights into this please? Or how to work around it?

Sub Macro1()
x = Shell("cmd.exe /c C:\temp\x.txt", 1)
End Sub

this works assuming the default app for .txt is NotePad
 
T

Terry Pinnell

James Ravenswood said:
Sub Macro1()
x = Shell("cmd.exe /c C:\temp\x.txt", 1)
End Sub

Thanks James. But I'm VERY rusty on this - years since I wrote any Excel
macros. After copying that to the clipboard and opening Tools > Macro >
Visual Basic Editor, do I just paste that into the empty Personal.XLS that
appears? If so, then what?
 
T

Terry Pinnell

Terry Pinnell said:
Thanks James. But I'm VERY rusty on this - years since I wrote any Excel
macros. After copying that to the clipboard and opening Tools > Macro >
Visual Basic Editor, do I just paste that into the empty Personal.XLS that
appears? If so, then what?

Anyone able to remind me what steps to get from the above to a working
macro please?
 
C

Cimjet

Hi Terry
Now go to Tools>Macro>Macros and select Personal.XLS!Macro1
if you didn't change the name of the macro then press Run.
Also you could create a button to execute the macro.
HTH
Cimjet
 

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