View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default How to detect MS Word or MS Access calls MS Excel using VBA

Application.Hinstance
Will give you the window handle of the calling application.

Then with this you can get the full path of the calling application with
code that was recently posted in
the microsoft.public.vb.winapi newsgroup:
GetModulePathFromHandle - by request. posted on 4 December by Kevin
Provance.

Maybe somebody knows a more direct way.

RBS


"Bon" wrote in message
oups.com...
Hello all

Is it possible to detect which application call the MS Excel using VBA?

I want to put some conditions in the Workbook_Open() method.

IF MS Word call Then
Do Job 1
Else
Do Job 2

Any methods for doing it?

Thanks
Bon