Help with Put Data on to IE webpage (1 Viewer)

sspreyer

Registered User.
Local time
Yesterday, 21:15
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:15
Joined
Oct 29, 2018
Messages
21,449
Hi. CreateObject() opens a new instance of IE. To get the one already open, try using GetObject() instead. Hope it helps...
 

sspreyer

Registered User.
Local time
Yesterday, 21:15
Joined
Nov 18, 2013
Messages
251
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:15
Joined
Oct 29, 2018
Messages
21,449
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.
 

sspreyer

Registered User.
Local time
Yesterday, 21:15
Joined
Nov 18, 2013
Messages
251
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:15
Joined
Oct 29, 2018
Messages
21,449
How about posting the code for us to troubleshoot?
 

MrHans

Registered User
Local time
Today, 06:15
Joined
Jul 27, 2015
Messages
147
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.
 

sspreyer

Registered User.
Local time
Yesterday, 21:15
Joined
Nov 18, 2013
Messages
251
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

Top Bottom