Results 1 to 3 of 3
  1. #1
    Varko Mondo
    Guest

    External program (Office 97/2000)

    Hi,

    I would like to add a button to my Word-taskbar, that on mouseclick activates Notepad. Is this possible within VBA to call an external program?

    thanks!

    Varko

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: External program (Office 97/2000)

    Hi,
    The following code works for me:
    Sub Notepad()
    Shell "notepad.exe", vbNormalFocus
    End Sub
    You can then assign this to a commandbar button.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: External program (Office 97/2000)

    If you want to refer in code to the program you're running that way, you'll need to get Shell to return the handle for the resulting program session. For instance, you could call the built-in calculator like this:

    RetVal = Shell("C:WINNTSystem32CALC.EXE", 1)

    In this case, RetVal will return the hWnd for the calculator window to the calling procedure. Then you could have another button or menu option that closed the application after first activating it using the RetVal handle.
    Charlotte

Posting Permissions

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