IE / VBA question

markejackson02

New Member
Joined
Feb 1, 2011
Messages
3
Two part question -

I am trying to download a file in XML format. The following code works on my machine at work, except it opens the annoying save dialog box. It does not work on my machine at home. Work is Win7 Pro with Office 2007. Home is Win7 Home Premium with Excel 2003.

The only difference are the references. At work, ieframe.dll points to the System32 directory while at home ieframe.dll points to the SysWow64 directory.

The problem is arising after I set the value for the first control. Updating it should cause the second control to change to an active control. As it is now, it is still in the initial state the does nothing. I have to manually click on the page to get it to update.

Is there any documentation for MS Internet Controls and HTML Object Library?

Thx

Mark Jackson



Code:
Sub LoadPage()

Dim szURL As String
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Dim oHTML_Element As IHTMLElement
Dim r As Long
Dim ws As Worksheet
Dim v As Variant

Set ws = ThisWorkbook.Sheets(1)
szURL = "http://www.ngtsnavigates.com/ReportServer/Pages/ReportViewer.aspx?%2fInfoPost%2fNotices&rs%3aCommand=Render&assetNbr=51&CritFlag=0"

Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.navigate szURL
oBrowser.Visible = True

Do ' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE

Set HTMLDoc = oBrowser.document
v = "ReportViewerControl_ctl01_ctl05_ctl00"
Set oHTML_Element = HTMLDoc.getElementById(v)
oHTML_Element.Value = "XML"

v = "ReportViewerControl_ctl01_ctl05_ctl01"
Set oHTML_Element = HTMLDoc.getElementById(v)
oHTML_Element.Click

oBrowser.Quit

End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Your code is interesting, but just curious, why would you not be doing a simpler web query to pull in the data? No web query I have seen or done has resulted in a default Save dialog box.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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