Results 1 to 12 of 12

[SOLVED]External Web Query Connection to login automatically

Threaded View

  1. #1
    Registered User
    Join Date
    04-08-2010
    Location
    Northeast
    MS-Off Ver
    Excel 2003
    Posts
    10

    Question [SOLVED]External Web Query Connection to login automatically

    Hello all!

    I've done quite a bit of searching trying to find the answer and hours and hours of manipulating and viewing source code to try and figure this out without any luck. Any help would be very much appreciated! Here are my issues:

    I want to open up a new workbook and have the webquery automatically sign in with a username and password. The code below works for opening a IE tab and signing in, but does not log-in the web queriesconnection. For example, I could be logged in to the website by using the first code but when I go to my excel sheet Data > Import External Data > Edit Query the website needs to be logged in to.

    This code opens up a IE browser and logs-in but does not refresh or establish a web query connection.
    Sub Macro2()
    Dim a As String
        Set IE = CreateObject("InternetExplorer.Application")
        With IE
            .Visible = True
            .navigate "http://www.nrucfc.coop/"
            Do Until .ReadyState = 4
                DoEvents
            Loop
            .document.all.Item("user").Value = "XXX"
            .document.all.Item("PassWord").Value = "YYY"
            .document.forms(0).submit
        End With
    End Sub

    This is ultimately what I'd want it to do but I don't know how to add a input to the ActiveSheet.QueryTables.Add connection for a username and password.
    Sub CoopIDDate()
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;http://www.domino.nrucfc.org/CFCApps/Financial/memsum.nsf/78342add422ca87a85256a0f004d46ff/" & Worksheets("Sheet1").Range("CoopID") _
            , Destination:=Range("A1"))
            .Name = "ak002"
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = False
            .RefreshOnFileOpen = False
            .BackgroundQuery = True
            .RefreshStyle = xlOverwriteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = False
            .RefreshPeriod = 0
            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingNone
            .WebTables = "8"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
    End Sub
    Can anybody help with a Web Query Password and Login of Excel 2003? I could not get others codes to work correctly. Thanks a TON in advance!
    Attached Files Attached Files
    Last edited by BByrd; 12-29-2011 at 12:59 PM. Reason: resolved

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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