?
Solved

Excel's VBA manipulating Internet Explorer Form

Posted on 2003-03-10
2
Medium Priority
?
2,940 Views
Last Modified: 2007-12-19
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("InternetExplorer.application")
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
0
Comment
Question by:da29647
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 8102863
See this documentation by Richie_Simonetti:

http://www.angelfire.com/realm/vb-shared/IE_WB_DOM_tips.htm#log
0
 

Author Comment

by:da29647
ID: 8104766
Exactly what I needed to take the next step.  Thanks for the rapid response.


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("InternetExplorer.application")

'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
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question