• passing argumnet in hyperlink (Word 2000/SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » passing argumnet in hyperlink (Word 2000/SR1)

    Author
    Topic
    #392314

    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

    Viewing 0 reply threads
    Author
    Replies
    • #703874

      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.

      Sub OpenDocInApp
        Shell "C:WinNTNotepad.exe ""C:/Test.txt"""
      End Sub

      Note the use of quotes.

      • #704041

        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,

        • #704086

          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 C:Documents and SettingsSmerdonkMy DocumentsTest.txt. If you included this in the instruction without those extra quotes, Notepad would try to open C:Documents, 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?

    Viewing 0 reply threads
    Reply To: passing argumnet in hyperlink (Word 2000/SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: