Macro to launch an external programme

Is there a Macro that will launch a specified external programme?

John Layne

formatting link

Reply to
John Layne
Loading thread data ...

If you have a short-cut for the program you want to start, you can in its properties assign a shortcut-key to launch, which would actually make it easier than making a macro in SW and a button to push.

I have it for launching out old customized toolworks, "ctrl+alt+T"

Reply to
Ronni

You might use the "ShellExecute" command. It is not immediately available in VBA. You need to use Windows API to set up these calls. "ShellExecute opens a file with its default program.

There is an example of this in one of my publicly available macros "CopyCustomInfo". I use ShellExecute to open the link to my website from the user interface.

' 'put this in the general declarations section of your macro ' 'ShellExecute API Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _ ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

' 'example of a Sub using "ShellExecute" ' Public Sub OpenEsoxWeb() ShellExecute 0, vbNullString, "

formatting link
",vbNullString, "C:\", 1 End Sub

Reply to
That70sTick

Look up SolidWorks API Help for the SHELL command. It's very easy stuff.

Matt

Reply to
fcsuper

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.