Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Vba to activate external window

  • 30-10-2012 3:43pm
    #1
    Closed Accounts Posts: 10,272 ✭✭✭✭


    Hi
    Ive tried googling this to a large extent and searched around but theres no conclusive answer

    Does anyone know how to activate (and then interact with) a window using vba code that was not created by the code?

    So for example a pre existing IE window or a window created manually using sendkeys

    Thanks!


Comments

  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    You have to hook into windows dlls and call the native api to do this, very hacky with vba.

    In banks etc they use various middleware solutions to bridge the gap, there is a product for example that lets you run C# inside excel - which gives a lot more freedom.


  • Closed Accounts Posts: 10,272 ✭✭✭✭Max Power1


    Very hacky? i like the way that sounds lmao. Do you know where I could find a sample code or some instructions/guidelines on this?


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Well just do it like you would with c++, find the HWND of the target window and then call normal api functions. With VBA you do the same thing: http://msdn.microsoft.com/en-us/library/office/aa165195(v=office.10).aspx

    Depends what version of office you are running too, the newer ones are more flexible.


Advertisement