ShellExecute starting new instance of Excel

  • Thread starter Thread starter Reg
  • Start date Start date
R

Reg

I have got an Excel Menu which needs to launch workbooks into the
current instance of Excel. I am trying to do this with the following :

hwnd = FindWindow("XLMAIN", Application.Caption)

lngResult = ShellExecute(hwnd, "open", strFilePath, vbNullString,
CurDir$, SW_SHOWNORMAL)

I am getting back a value of the hwnd but for some reason it always
launches the workbook in strPath into a new instance of Excel.

Any ideas ?

Rich
 
just use

workbooks.open Filename:=sPath & "\" & sFilename

skip all the API stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top