Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upgrading from Windows XP to Windows 7 broke this macro

Status
Not open for further replies.

makavity

Programmer
Nov 23, 2003
36
US
I have a macro that was written a few years ago, and the team now using it is having trouble after upgrading their systems to Windows 7.

The macro launches from Excel, opens an Internet Explorer window and captures data after entering a few things. I haven't been able to find the solution, nor have I upgraded my computer yet. (yes i know it's outdated, but we have what we have).

Sub CORE_Browse()

Dim objIE As Object
Dim objParent As Object
Dim varTables, varTable
Dim varRows, varRow
Dim varCells, varCell
Dim lngRow As Long, lngColumn As Long
Dim strBuffer As String
Dim CORE_Row As Variant

'Getting UserID
User_ID = "asdf"
User_Password = "asdf"

'Opening an Internet Explorer Window and Navigating to CORE Browse
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.Navigate "End With
While objIE.Busy
Wend
While objIE.Document.readystate <> "complete" '********** THE MACRO BREAKS HERE ************ If deleted this code, the macro still breaks below.
Wend

Set objParent = objIE.Document.Forms("form1") '********** THE MACRO BREAKS HERE ************
With objParent
objParent.Item("userid").Value = User_ID
objParent.Item("password").Value = User_Password
.Submit
End With
While objIE.Busy
Wend
While objIE.Document.readystate <> "complete"
Wend

Is there something new about Windows 7, and the version of Internet Explorer that breaks this code? Or could it be a setting in Excel?

Any help would be appreciated

JR
 
Try replacing:
While objIE.Document.readystate <> "complete"
Wend

with:
Do
DoEvents
Loop Until objIE.readyState = READYSTATE_COMPLETE

Cheers
Paul Edstein
[MS MVP - Word]
 
Alternatively:
Do Until IE.readyState = 4
Loop


Cheers
Paul Edstein
[MS MVP - Word]
 
Thanks for the info. I'll let you know how it works out.

On a side note, the macro still works on my Windows XP computer, just not on the Windows 7 upgraded computers.

JR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top