Shuvro Basu

Hello Everyone,

I need to do the following and would appreciate help from any direction.

1) I would like to select a window (either hidden, child, parent or from the taskbar),

2) Get the window title

3) Save the title in a text box

4) Change the window title and send a mouse click to a specific button on the window if the button is present

5) Change the opacity of the window

Thanks in advance for all your help.

BTW: I know I need to use EnumWindows, GetWindowText etc. but I am not confident on what the code should be.


Re: WinAPI in Excel using VBA

Mercury Schroeppel

Hi, Shuvro. Can you explain a bit more about what you want to do The steps you describe could be very easy, or very hard, depending on your goals.

For instance, when you say "window", do you mean the O/S version of a window, which is almost anything Or do you mean Excel-type windows, built-in dialogs, and/or custom user forms

Are you looking for any windows in particular

What is the overall purpose of this code What type of button are you looking for in step 4, and why do you want to send a click to it

Re: WinAPI in Excel using VBA

Shuvro Basu


Thanks for your response.

When I refer to "Window" I mean any window object, this could be a application window like Excel, a dialog box within Excel (say File Save) or something else or even a message box or userform.

I am not looking for any particular window. What I should be able to do is something like WinSpy++ wherein you can see all the windows open (irrespective of type plus more). I want to create an userform in excel to show all the open Windows (not anyother class like menus, control boxes etc.) and be able to select them from a listbox which will be populated with the details. This is the first part.

The second part consists of another issue wherein I need to use api calls to locate a particular dialog box that comes up (Outlook security in Office 2k3) which doesnt allow Outlook to send email messages from another source like XL, Word or PPT. I need to find this particular security dialog, click on "YES" (rather send a click message or something) and this is done transperantly to the use since if I am sending 100 emails from XL through Outlook, I need to click the "Yes" button 100 times!!!!

Hope this clarifies.