Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    passing argumnet in hyperlink (Word 2000/SR1)

    In a Hyperlink we wish to be able to launch an executable which works such as the following which does launch Notepad "C:WINNTNotepad.exe". Now if we add an argument such as a txt file to open "C:WINNTNotepad.exe C:text.txt" it does not work. Is there some way of doing this?

    Thank you

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: passing argumnet in hyperlink (Word 2000/SR1)

    If you want to open a document with an extension that has an associated application, you don't need to specify the application in the hyperlink, just the document will do. If you need to specify the application, I don't think you can do this in a hyperlink. You can create a macro that opens a document in a specific application, and make this availabe through a macrobutton field, custom toolbar button etc.<pre>Sub OpenDocInApp
    Shell "C:WinNTNotepad.exe ""C:/Test.txt"""
    End Sub</pre>

    Note the use of quotes.

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Midland, Michigan, USA
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: passing argumnet in hyperlink (Word 2000/SR1)

    Is there any chance you could explain the sequence of quotation marks? I understand the shell statment is looking for a string; Is it that preceeding a quotation mark with a quotation mark will cause the 2nd quote to become part of the string? (am I making sense?).

    Thanks,

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: passing argumnet in hyperlink (Word 2000/SR1)

    Your assumption is correct. Strictly speaking, the double double quotes around C:Test.txt were not necessary in my example. They are necessary if the path or filename of the document to be opened contains spaces. Say that the document is in Cocuments and SettingsSmerdonkMy DocumentsTest.txt. If you included this in the instruction without those extra quotes, Notepad would try to open Cocuments, then choke. To indicate that the entire path/filename belongs together, we must enclose it in quotes. But the argument to the Shell statement already has quotes around it. If you want to put quotes inside a quoted string, you must double them. Confusing, eh?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •