da29647
asked on
Excel's VBA manipulating Internet Explorer Form
Greetings - this one should be quite simple, but I just can't figure out the syntax.
I am trying to write a VBA program in Excel which launches Internet Explorer, Navigates to a specific web page, and pastes information into the Form on that web page.
I have the launching and navigating working fine.
I can write text to the web page - but the text doesn't show up in the form on the web page. I am having a hard time manipulating the form once I am there. Any help would be appreciated.
Here's what I have so far:
Sub test()
Dim ie As Object
Set ie = CreateObject("InternetExpl orer.appli cation")
ie.Visible = True
ie.navigate ("c:\new_page_5.htm")
'this will write to the web screen - just not in the form
screen = ie.document.Focus
ie.document.write ("testing the ability to send information to the i.e. screen")
End Sub
Thanks,
Dave
I am trying to write a VBA program in Excel which launches Internet Explorer, Navigates to a specific web page, and pastes information into the Form on that web page.
I have the launching and navigating working fine.
I can write text to the web page - but the text doesn't show up in the form on the web page. I am having a hard time manipulating the form once I am there. Any help would be appreciated.
Here's what I have so far:
Sub test()
Dim ie As Object
Set ie = CreateObject("InternetExpl
ie.Visible = True
ie.navigate ("c:\new_page_5.htm")
'this will write to the web screen - just not in the form
screen = ie.document.Focus
ie.document.write ("testing the ability to send information to the i.e. screen")
End Sub
Thanks,
Dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here's the final code for the rest of the world:
Sub test()
'this demonstrates how to integrate Excel with Internet Explorer
'this will launch Ie, navigate to a page, and send data from
'Excel into the User form.
'this is written in VBA
Dim ie As Object
Dim form_item As Object
Set ie = CreateObject("InternetExpl
'make internet explorer visible
ie.Visible = True
'navigates to page with form
ie.navigate ("c:\new_page_5.htm")
'the name of the form item is S1
Set form_item = ie.document.all.Item("S1")
'goes through the Excel rows and makes a gigantic string with each segment
'of the string separated by a line feed
For Row = 2 To 501
grabbed_out = grabbed_out & Cells(Row, 2) & Chr(13)
Next Row
'places the value of that entire string into the form
form_item.Value = grabbed_out
End Sub