Help with Put Data on to IE webpage

sspreyer

Registered User.
Local time
Today, 14:10
Joined
Nov 18, 2013
Messages
251
hi,

I have DB with a form contain 4 Text Boxes the data from the Text Boxes populate the web page controls. Which Works great i'm not the greatest coder surprised myself it worked lol. Now the problem i have it always opens a new internet explorer session every time i run the code. i know its this line is the cause for it to open a new session.
Code:
 'Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "www.MYWEBSITE.com"

my question is if i already have IE session open already and its on the website how to set focus to the current session instead of opening a new session. any help really much appreciated and will speed my day job up dramatically.

thanks in advance

shane

Full Code for your view ('Not great but works":D

Code:
Dim IE As InternetExplorer
    Set IE = New InternetExplorer

 'Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "www.MYWEBSITE.com"
Do While (IE.Busy)
Call Pause(2)
Loop

IE.Document.getElementById("vin").Value = Me.testVin
Call Pause(2)
IE.Document.Forms(0).submit
Call Pause(2)
IE.Document.getElementById("manufacturer").Value = Me.trailerman
Call Pause(2)
IE.Document.Forms(0).submit
Call Pause(2)
IE.Document.getElementById("wizard_trailer_weights_gross_weight").Value = Me.grossweight
'Call Pause(2)
IE.Document.getElementById("wizard_trailer_weights_unladen_weight").Value = Me.ladenWeight
Call Pause(2)
IE.Document.Forms(0).submit
end sub
 
Hi. CreateObject() opens a new instance of IE. To get the one already open, try using GetObject() instead. Hope it helps...
 
Hi. CreateObject() opens a new instance of IE. To get the one already open, try using GetObject() instead. Hope it helps...

tried Getobject not working not sure what else to try thanks

shane
 
Hi Shane. "not working" could mean a lot of things. What happened? Did you get an error? If so, what did it say? To help you fix the problem, can you post the code you tried? Thanks.
 
Hi Shane. "not working" could mean a lot of things. What happened? Did you get an error? If so, what did it say? To help you fix the problem, can you post the code you tried? Thanks.

Sorry no error did nothing
 
How about posting the code for us to troubleshoot?
 
I believe you should first test if the object is already open with the GetObject method, if that gives an error you should trap it and run the CreateObject method instead.
 
Hi

i wasn't get an error as i left on error resume next line in

i get automation snytax error with below after google some more doesn't seem people use getobject with IE some how check it with shell?


Code:
Private Sub Command13_Click()


Dim IE As InternetExplorer
  Set IE = GetObject("InternetExplorer.Application")
IE.Visible = True
Call Pause(2)

IE.Document.All("wizard_trailer_have_vin[has_vin]").Item(0).Checked = True
Call Pause(2)
IE.Document.getElementById("vin").Value = Me.testVin
Call Pause(2)
IE.Document.Forms(0).submit
Call Pause(2)
IE.Document.getElementById("manufacturer").Value = Me.trailerman
Call Pause(2)
IE.Document.Forms(0).submit
Call Pause(2)
IE.Document.getElementById("wizard_trailer_weights_gross_weight").Value = Me.grossweight
'Call Pause(2)
IE.Document.getElementById("wizard_trailer_weights_unladen_weight").Value = Me.ladenWeight
Call Pause(2)
IE.Document.Forms(0).submit

End Sub
 

Users who are viewing this thread

Back
Top Bottom