View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Keith Willshaw Keith Willshaw is offline
external usenet poster
 
Posts: 170
Default run exe program and locate current workbook


"Domagoj Vulin" wrote in message
...
I have 2 questions:
1. how can I determine the current working folder of a XLS file with a
macro? GetAbsolutePath didn't give me the best results...


What do youmean by this ?


2. is it possible to run .exe program from a VBA macro and how?



Yes , you can use the shell function

Progid = Shell(pathname[,windowstyle])

Progid is a variable of type double and the returns
the process ID if it works or 0 otherwise

pathname - Required String holding the name of the program to execute and
any required arguments or command-line switches; may include directory or
folder and drive.

windowstyle - Optional integer defining style of window in which program
is run , use one of the intrinsic constants

vbHide0
vbNormalFocus
vbMinimizedFocus
vbMaximizedFocus
vbNormalNoFocus
vbMinimizedNoFocus6

Note the program executes asynchronously, that is VBA
does NOT wait for it to complete before carrying on.

Keith