Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening other applications from VBScript

Status
Not open for further replies.

JTBorton

Technical User
Jun 9, 2008
345
DE
I have a coworker who is hopelessly addicted to mine sweeper, and everyone knows it. Our process control software allows VB scripts to be linked to different control icons. As a subtle joke, I want to make mine sweeper pop up when she clicks on the controller graphic. I have opened other office applications from VBA before and figured that would be a good model to start with. Here is what I tried:

Code:
Sub OpenMinesweeper()
    Dim objApp
    On Error Resume Next
        Set objApp = GetObject(, "Minesweeper.Application")
        If objApp Is Nothing Then
            Set objApp = CreateObject("Minesweeper.Application")
        End If
        If objApp Is Nothing Then
            MsgBox prompt:="Unable to open application.", Buttons:=vbExclamation + vbOKOnly + vbApplicationModal
            Exit Sub
        End If
    On Error GoTo 0
End Sub

But this doesn't seem work. Any ideas on how to open a non-office application? Again this is VBScript (which I am not as familiar with), but I'm testing it in VBA (hence the use of a msgbox).

-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
Why not simply this ?
Shell("cmd /C ""%SystemRoot%\system32\winmine.exe""")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
oh wow. That's a new one for me. Why so many quotation marks at the end? And why the percent signs before the slashes?

-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top