VBA Macro to Select from Dropdown (combobox) in Already Open Internet Explorer Tab

lpan131313

New Member
Joined
Jan 30, 2019
Messages
1
Hello All,


I'm hoping someone can help. I amtrying to create a macro using excel that will reference an already openinternet explorer tab and choose from dropdowns (they appear to be comboboxes).If it is relevant, it is an erp site. The website ishttps://ep.erp.navy.mil/irj/portal. I have some code that will check that thepage is open but won't run the rest of the code. Here is the code so far:

Code:
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT]Sub ietest5()


 Const myPageTitle As String = "SAP"
 Const myPageURL As String = "https://ep.erp.navy.mil/irj/portal"
 Const mySearchForm As String = "DROPDOWN_ITEM_15_AcDDLBase_combobox-r"
 Const mySearchInput As String = "DROPDOWN_ITEM_15_AcDDLBase_combobox"
 Const mySearchTerm As String = "Document Object Model"
 Const myButton As String = "Go"

 Dim myIE As SHDocVw.InternetExplorer
 Dim ieDoc As Object
 'check if page is already open
 Set myIE = GetOpenIEByTitle(myPageTitle, False)

 If myIE Is Nothing Then
 'page isn't open yet
 'create new IE instance
 Set myIE = GetNewIE
 'make IE window visible
 myIE.Visible = True
 'load page
 If LoadWebPage(myIE, myPageURL) = False Then
 'page wasn't loaded
 MsgBox "Couldn't open page"
 Exit Sub
 End If
 End If

 With myIE.Document.form(mySearchForm) 'enter search term in text field
 .elements(mySearchInput).Value = "Simulation"
 'press button "Go"
 ' .elements(myButton).Click
 End With

 End Sub


 Other code i was trying to use is:

 'ieDoc.getElementById("DROPDOWN_ITEM_15_AcDDLBase_combobox").Focus
 'ieDoc.getElementById("DROPDOWN_ITEM_15_AcDDLBase_combobox").Value = "Simulation".

[\code]

 I don't know how to paste the source code
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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