Populating ComboBox in pop-up window from external website

minnmike

New Member
Joined
Aug 15, 2012
Messages
1
First time poster.

System / Version information:
Microsoft Windows XP Professional 5.1.2600
Excel 2007 / Visual Basic 6.5.

Background / synopsis:

I am using Excel to open up an external website to generate reports. When it comes time to launch the report, a pop-up appears with combo boxes to govern the default location and name of the report.

How do I use VB 6.5 to simulate typing a value into a combo box, when the combo box originates as a pop-up from an external website, and is not part of the spreadsheet itself?

Details:

1) I am using the Excel spreadsheet to open up an external web address using a key-fob + password login.

2) On that webpage, selecting a hyperlink leads me to another website with a regular password-protected login.

3) After the second login, I click a menu item which refreshes the page.

4) On the refreshed page, I use the

Set ieDoc = ieApp.Document
and
ieDoc.getElementById("element_name")

to set a number of values on the page: these values become parameters for the report.

My program loops over combinations of the values. This will be important later.

5) I then click the "Launch" button.

6) This brings two windows: a parent window and a "File Download" window.

6a) The "File Download" window has the usual Open, Save, Cancel buttons.

7) I use the "FindWindow" and "FindWindowEx" commands to locate the hWnd of the Save Button on the "File Download" window.

8) I then use SetCursorPos and SetWindowPos to set focus on the save button, and SendMessage BM_CLICK to simulate clicking "Save"

9) This brings up two *more* windows. One is a % saved tracking the download, and a "Save As" window.

This is where my question is.

10) The "Save As" window has three combo boxes,
Save in:
File name:
Save as type:


11) I am trying to use VB to assign a value to the Save in: and/or the File name: combo boxes (as though I were typing it in by hand).

12) This is because each time the Save As window comes up, I am saving a different report and the default values in the combo boxes make the new reports overwrite the old ones.

Can someone tell me

a) whether I can/should use SendMessage to populate a combobox on an external popup
b) if I use SendMessage, either an example, a website which documents SendMessage, or a good book (name/author or ISBN)
c) if there is another way to refer to the external combobox as an object, and the method I use to simulate typing in
d) whatever else works, including sample code?

As I have searched for answers to this, all I have found has been code on how to populate a combobox which is already part of the Excel spreadsheet. As far as I can tell, these solutions do not work: I don't have a name for the "SaveAs" window, NOR for the combo boxes on it.

Also -- this is my first post. Can someone let me know how to post code as part of a posting, and I will try to include whatever code is relevant?

If I post this question on other forums, I will let them know it has been posted here; and I will add a comment to this thread to say where else this question has been posted.

Thanks VERY much!

minnmike
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,226
Messages
6,177,275
Members
452,765
Latest member
Erka Gizli

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top