# Solved: Excel Macro to start an external application



## Scanerman (Oct 2, 2002)

I would like to create a macro that starts a comms application to download data from a portable data terminal via COM1 but I can't find any way in the Excel Macro environment to start an external application. All a want to do is to run a .bat file to open the comms.

Anybody got any ideas?


----------



## Gram123 (Mar 15, 2001)

The easiest way to do this, as far as I can tell, is to add a new button to one of your toolbars and assign a hyperlink to it.

This was my test:

Right-click in the grey toolbar area > Customize.
On the Commands tab, select Macros in the Categories pane and Custom button in the Commands pane. Drag this to a toolbar.
With the Customize dialog box still open, right click your new button > Assign hyperlink > Open.
Locate your file.
OK.
Change your button image as required...

I tried this with the Calculator from Programs - Accessories and it worked fine.

Is that sufficient for you?

Gram


----------



## xXLdev (May 17, 2004)

If you are looking for the VBA code try this:


```
' Specifying 1 as the second argument opens the application in 
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)    ' Run Calculator.
```


----------



## Scanerman (Oct 2, 2002)

Thanks. It sounds ideal. I'll try it and let you know.


----------



## Scanerman (Oct 2, 2002)

Perfik. It works exaactly as I wanted. Shell was the command I couldn't find. I'll read up and find out how I can use it for other jobs. Thanks very much both of you.


----------



## Anne Troy (Feb 14, 1999)

Marked solved!


----------

