By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Can IE be automated?

P: n/a
I have a textbox for storing the URL to a web page. I figured the
person could simply copy the URL from IE and paste it into the text box.
The client would like to have a more automated process.

We came upon one "glitch". We pasted the URL into the Access text box
and went back to it and it didn't go to the right page. The reason is
that frames were used in the page so although the page was OK, the
content wasn't.

To overcome that, we did a File/Save within IE and saved it to an htm
file on the drive. This gave us the correct content.

I mentioned to the client that a person could have 1 or many IE windows
open at one time. I suppose I could cycle through the class/caption
names and present a popup list to select the window they want. From
there, I'd suppose I could do a file save. The problem I see is that
when you do a File/Save, the folder most likely wont be the correct
folder...the drive is different, the folder different. So it would be
nice to stuff the drive/folder/filename too.

Is IE able to be automated? Can I tell it to File/Save and stuff
requistite values in it from Access if I know which page is selected?

Another thing I could do is have them save the page to C:\HTML. In the
form I could have a timer event and if the app saw a file in it to copy
the HTML file to a standardized network folder, kill the C:\HTML file,
and stuff the new network filename into the text box. Then again, I'd
have to FORCE the user to always save those pages/html files to
C:\HTML...and that's not automated.

Any ideas?
Nov 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Yes, you can automate IE. Set a reference to Microsoft Internet Controls
and then you can do things like:-

Form with three command buttson (Command0, Command1, Command2)

Option Explicit

Dim ie As SHDocVw.InternetExplorer

Private Sub Command0_Click()
Set ie = New SHDocVw.InternetExplorer

With ie
.Navigate2 "Some Valid Url In Here"
.Visible = True
End With
End Sub

Private Sub Command1_Click()
MsgBox ie.LocationURL
End Sub

Private Sub Command2_Click()
ie.Quit
Set ie = Nothing
End Sub

Private Sub Form_Load()
With Me
.Command0.Caption = "Open"
.Command1.Caption = "Get"
.Command2.Caption = "Close"
End With
End Sub
--
Terry Kreft

"Salad" <oi*@vinegar.com> wrote in message
news:uD***************@newsread1.news.pas.earthlin k.net...
I have a textbox for storing the URL to a web page. I figured the person
could simply copy the URL from IE and paste it into the text box. The
client would like to have a more automated process.

We came upon one "glitch". We pasted the URL into the Access text box and
went back to it and it didn't go to the right page. The reason is that
frames were used in the page so although the page was OK, the content
wasn't.

To overcome that, we did a File/Save within IE and saved it to an htm file
on the drive. This gave us the correct content.

I mentioned to the client that a person could have 1 or many IE windows
open at one time. I suppose I could cycle through the class/caption names
and present a popup list to select the window they want. From there, I'd
suppose I could do a file save. The problem I see is that when you do a
File/Save, the folder most likely wont be the correct folder...the drive
is different, the folder different. So it would be nice to stuff the
drive/folder/filename too.

Is IE able to be automated? Can I tell it to File/Save and stuff
requistite values in it from Access if I know which page is selected?

Another thing I could do is have them save the page to C:\HTML. In the
form I could have a timer event and if the app saw a file in it to copy
the HTML file to a standardized network folder, kill the C:\HTML file, and
stuff the new network filename into the text box. Then again, I'd have to
FORCE the user to always save those pages/html files to C:\HTML...and
that's not automated.

Any ideas?

Nov 23 '05 #2

P: n/a
Terry Kreft wrote:

Hi Terry Great stuff. Can you provide some more assistance? See below.
Yes, you can automate IE. Set a reference to Microsoft Internet Controls
and then you can do things like:-

Form with three command buttson (Command0, Command1, Command2)

Option Explicit

Dim ie As SHDocVw.InternetExplorer

Private Sub Command0_Click()
Set ie = New SHDocVw.InternetExplorer

With ie
.Navigate2 "Some Valid Url In Here"
.Visible = True
End With
End Sub

Private Sub Command1_Click()
MsgBox ie.LocationURL
End Sub

Private Sub Command2_Click()
ie.Quit
Set ie = Nothing
End Sub

Private Sub Form_Load()
With Me
.Command0.Caption = "Open"
.Command1.Caption = "Get"
.Command2.Caption = "Close"
End With
End Sub


I created a form with your code above and it worked like a champ...if
the web page did not open another web page in another window. For
example, I tested it out with the following page.
http://www.ferguson.com/MaufacturerL...nuflinks.shtml

The links on this page open up another page in another window. If I hit
"Get" it gets the link for the original page. I guess that should be
expected.

Let's say that the user called the original page but had 2/3 pages open.
I know I could cycle through the pages via class names and get the
captions for those pages. From there, I could present a listbox or
dropdown of those captions and let the op select the caption. Is there
anything I could do, from that list, to get the URL?

We decided that those that work with frames...well...hopefully there
aren't too many sites that use them. Frames are basically
"non-standard"...maybe they are common, hopefully not. But even getting
the URL for that would be OK...it's better than nothing.

I feel like I'm so close with your code...yet not quite there.

I didn't see any properties or methods where I could File/Save the page.
File/Saving handled the frames situation but that's not necessary per
the client's wishes...your code is so much better.

Nov 24 '05 #3

P: n/a
salad wrote:
Terry Kreft wrote:

Hi Terry Great stuff. Can you provide some more assistance? See below.

I think the following link answers my questions.
http://www.mvps.org/access/api/api0051.htm
Nov 25 '05 #4

P: n/a
Look like it ot me as well.

Thanks for stopping me from starting to hammer code <g>.

--
Terry Kreft

"salad" <oi*@vinegar.com> wrote in message
news:g0***************@newsread1.news.pas.earthlin k.net...
salad wrote:
Terry Kreft wrote:

Hi Terry Great stuff. Can you provide some more assistance? See below.

I think the following link answers my questions.
http://www.mvps.org/access/api/api0051.htm

Nov 25 '05 #5

P: n/a
Terry Kreft wrote:
Look like it ot me as well.

Thanks for stopping me from starting to hammer code <g>.

Yeah, and stopping you from enjoying a Happy Thanksgiving or duking it
out with other Walmart shoppers for the $399 laptop. :-)

I will use your code to launch the app. It's good stuff to know.
Nov 25 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.