Microsoft® Excel® based database addin

 

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Bon Guest

    Default How to detect MS Word or MS Access calls MS Excel using VBA

    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


  2. #2
    RB Smissaert Guest

    Default Re: 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" <bonnie.tangyn@gmail.com> wrote in message
    news:1134704437.461395.219650@g47g2000cwa.googlegr 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
    >



  3. #3
    RB Smissaert Guest

    Default Re: How to detect MS Word or MS Access calls MS Excel using VBA

    Ignore my post as Hinstance returns the instance handle not the window
    handle.

    RBS

    "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    news:e0sebalAGHA.912@TK2MSFTNGP11.phx.gbl...
    > 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" <bonnie.tangyn@gmail.com> wrote in message
    > news:1134704437.461395.219650@g47g2000cwa.googlegr 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
    >>

    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts