+ Reply to Thread
Results 1 to 5 of 5

Code to Open Multiple Websites at Once

  1. #1
    Registered User
    Join Date
    07-18-2014
    Location
    Lexington, KY
    MS-Off Ver
    2007
    Posts
    29

    Code to Open Multiple Websites at Once

    I have used the following code to open four websites in different tabs with the press of a button created on an Excel spreadsheet. Until today, there have been no problems. Now, the first website (pilotbrief) does not open, only the other three. I don't know what happened...


    Please Login or Register  to view this content.
    Any ideas?

    Thanks in advance.

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Code to Open Multiple Websites at Once

    Perhaps there is an instance of IE that is open but not visible already. You could add code to force close IE at the the beginning of your subroutine.

    Sub OpsBrief()

    ' Open websites associated with morning brief
    Dim strURL As String, fail As Boolean
    Dim objIE As Object
    Dim arrSites(4)
    Dim objWMI As Object, objProcess As Object, objProcesses As Object
    Set objWMI = GetObject("winmgmts://.")
    Set objProcesses = objWMI.ExecQuery( _
    "SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'")
    For Each objProcess In objProcesses
    Call objProcess.Terminate
    Next
    Set objProcesses = Nothing: Set objWMI = Nothing
    arrSites(0) = "https://www.pilotbrief.com/Optima/Nav/BrowseChartsLite/conus"
    arrSites(1) = "http://www.timeanddate.com/astronomy/usa/frankfort"
    arrSites(2) = "https://sharepoint.ky.ngb.army.mil/DMA/aviation/Lists/Flight%20Tracker%2020/All%20Aircraft.aspx"
    arrSites(3) = "http://www.wunderground.com/q/zmw:40601.1.99999"
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Navigate arrSites(1)
    For i = 1 To 3
    objIE.Navigate2 arrSites(i), 2048
    Next i
    objIE.Visible = True
    Set objIE = Nothing

    End Sub
    Frob first, tweak later

  3. #3
    Registered User
    Join Date
    07-18-2014
    Location
    Lexington, KY
    MS-Off Ver
    2007
    Posts
    29

    Re: Code to Open Multiple Websites at Once

    Thanks for the reply. If that's the case, would it not affect the rest of the websites? The other three sites open as they should. It's just the first one now that does not.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code to Open Multiple Websites at Once

    They all open fine for me, apart from the Sharepoint site of course.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    07-18-2014
    Location
    Lexington, KY
    MS-Off Ver
    2007
    Posts
    29

    Re: Code to Open Multiple Websites at Once

    Norie,
    Thanks for checking. Maybe something my administrator has done that would stop it, though I don't know why since the first website is really no different from the other two (sharepoint aside of course). I will look at that...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Search a Text in source code of multiple websites through Excel
    By alwaysprashant in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-02-2017, 03:58 PM
  2. Import data from multiple websites (loop?)
    By Nina07 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-24-2016, 02:59 PM
  3. [SOLVED] Need VBA code to scrape data into excel from list of websites
    By nadair1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2014, 11:45 AM
  4. Vba - retrieve value from multiple internet explorer websites to multiple cells
    By pexpex223 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2014, 04:42 PM
  5. [SOLVED] Trouble saving a websites source code to a text file.
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2013, 09:11 AM
  6. [SOLVED] URLs and navigating websites to pull source code
    By Zaf01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2012, 04:47 PM
  7. Get data(Tables) from multiple websites
    By Primordium in forum Excel General
    Replies: 0
    Last Post: 07-30-2012, 10:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1