Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Toolbar: Launch Another Program (2003)

    What code would I use in a macro to start another program from Word, a non-office program?

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

    Re: Toolbar: Launch Another Program (2003)

    You can use the Shell instruction. Its syntax is

    Shell pathname, windowstyle

    where pathname is a string specifying the path and filename of the application, and windowstyle can be

    vbHide
    vbNormalFocus
    vbMinimizedFocus (default)
    vbMaximizedFocus
    vbNormalNoFocus
    vbMinimizedNoFocus

    Example:

    Shell "C:Windowssystem32Calc.exe", vbNormalFocus

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Toolbar: Launch Another Program (2003)

    How do I launch a particular file at the same time with the startup options if the file has spaces in it since I can't use double quotes?

    Shell "C:Program FilesMicrosoft OfficeOFFICE11EXCEL.EXE /fC:Ascend2020 PHX ADT.xls", vbNormalFocus

    Thanks!

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

    Re: Toolbar: Launch Another Program (2003)

    Use double double quotes! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    <code>Shell "C:Program FilesMicrosoft OfficeOFFICE11EXCEL.EXE ""C:Ascend2020 PHX ADT.xls""", vbNormalFocus</code>

    Or you can just open the document using FoolowHyperlink. Windows knows that a .xls file should be opened in Excel:

    <code>ActiveDocument.FollowHyperlink "C:Ascend2020 PHX ADT.xls"</code>

  5. #5
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Toolbar: Launch Another Program (2003)

    Is there a way...I can use a variable in the pathname of a hyperlink? For example:

    Dim strMTUser as String
    strMTUser = ActiveDocument.Bookmarks("mtuser").Range.Text
    ActiveDocument.FollowHyperlink "https://helpdesk.confidential.com/OPS/File_Upload_MT.asp?Folder=MT_User_FoldersstrMTUser CQI Coaching"

    Alternatively, I suppose I can put the hyperlink actually in the document, but would rather not.

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

    Re: Toolbar: Launch Another Program (2003)

    You must concatenate the fixed and variable parts like this:

    ActiveDocument.FollowHyperlink "https://helpdesk.confidential.com/OPS/File_Upload_MT.asp?Folder=MT_User_Folders" & strMTUser & "CQI Coaching"

Posting Permissions

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