Results 1 to 4 of 4
  1. #1
    Stokecpa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    5

    VBA > Internet Explorer

    I am interested in vba code to control IE. My current interest is in automating opening several webpages and then automatically logging into each of them. To further complicate it, I would like all of the pages to end up in tabs in one browser session. There are many examples of vba code to do the opening and logins but my issue is with the tabs. Everything that I have found that does the login opens each website in a different IE browser session. I have found a script that works to open all the pages in tabs but I can't seem to get the login code to work with it. Does anyone have code they have worked out to handle this?

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    where did you find the code to set the focus on different tabs? I have yet to find that. you can open all of the pages in different tabs? what's the link to that script?

    if the script is actually opening each tab individually and not cheating (like finding a way to code the "re-open last browser session" method using the IE object), then that tells you there *is* a way to change the focus to different tabs with the ie object.

    once you find where that code is at in your script, it's all javascript from there. and this thread will tell you how to do the rest:

    http://www.access-programmers.co.uk/...d.php?t=176968

  3. #3
    Stokecpa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    5
    The tab code that I mentioned opens the specified websites, each in a new tab. Here it is:

    Private Sub Command227_Click()
    Dim waittime

    On Error GoTo Err_Clear

    waittime = 2000
    'to launch a new instance of ie7


    On Error GoTo Err_Clear
    ShellExecute 0, "open", "https://1stwebsite.com", vbNullString, vbNullString, vbMaximizedFocus
    Sleep (waittime)
    ShellExecute 0, "open", "https://2ndwebsite.com", vbNullString, vbNullString, vbMaximizedFocus
    Sleep (waittime)
    ‘Add code here to open additional sites
    Err_Clear:
    If Err <> 0 Then
    Err.Clear
    Resume Next
    End If

    End Sub

    Hope it helps you.

    Quote Originally Posted by help_me_with_access View Post
    where did you find the code to set the focus on different tabs? I have yet to find that. you can open all of the pages in different tabs? what's the link to that script?

    if the script is actually opening each tab individually and not cheating (like finding a way to code the "re-open last browser session" method using the IE object), then that tells you there *is* a way to change the focus to different tabs with the ie object.

    once you find where that code is at in your script, it's all javascript from there. and this thread will tell you how to do the rest:

    http://www.access-programmers.co.uk/...d.php?t=176968

  4. #4
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    i have never heard of the command "ShellExecute" before, nor have I used it. but I can tell that you that you probably can't use it to actually SET the focus on the different tabs. It looks like this is just coincidence as to what it is doing for you. kind of lucky you ran across it, really.

    but if this is the case, you can still do logins before each new tab is opened. see that thread I mentioned. it's all in there. but be aware that the commands that article mentions about "waiting for IE.BUSY = false"....all of that has been thoroughly tested. ie.busy and ie.readystate are *not* trustworthy on a windows machine. so it's all left up to chance on weather or not your code will work if you use those methods.

    what I've seen is that your best bet is to sleep() the code even more after ie.busy = false or ie.readystate = idle. simply because the returns don't always work.

    oh by the way, it may be the case that these methods *do* actually work, but the returns come back to the program immediately when the all the server's information is done sending (or the server is done communicating, simply), but before the browser has actually had time to render anything on the webpage. If that is true, the reason I state why they don't work is probably true, because that gives a true execution point that was the target for visual basic to indicate a return value is indeed valid for the ie.busy property (or the other one). And again, what that would a*also* mean is that IE is still a terrible browser because it is too slow to respond to visual basic's processing needs.

    follow?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. File Explorer in VBA
    By ybg1 in forum Programming
    Replies: 6
    Last Post: 02-06-2012, 03:55 PM
  2. API: Drag and Drop from Explorer to a text box
    By ybg1 in forum Programming
    Replies: 1
    Last Post: 01-02-2012, 02:23 PM
  3. Internet Explorer automation with VBA
    By sa230e in forum Programming
    Replies: 0
    Last Post: 09-29-2011, 05:04 PM
  4. access on the internet
    By tommy in forum Access
    Replies: 2
    Last Post: 06-28-2011, 09:35 AM
  5. Access 97: Unable to find project explorer?
    By captgnvr in forum Programming
    Replies: 0
    Last Post: 07-19-2010, 09:20 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums