aviationgeek
New Member
- Joined
- Oct 20, 2015
- Messages
- 4
I am running into an issue when using the Query Table Connection. I am trying to access a URL that provides a data set that I want to import into Excel. When the macro access the server, it prompts the user to enter their password. Is there any code available to hard code the username/password directly into the excel macro so the user is not required to enter this information.
If the Query Table connection is not the best way to access this information and input it into excel, I am open to any other ideas as well. The code I currently have is below.
URL is a predefined dim to change depending on the start and end dates that the user inputs.
Worksheets("Data Holder").Activate
With ActiveSheet.QueryTables.Add(Connection:=URL _
, Destination:=Range("$A$1"))
.Name = "Raw"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
If the Query Table connection is not the best way to access this information and input it into excel, I am open to any other ideas as well. The code I currently have is below.
URL is a predefined dim to change depending on the start and end dates that the user inputs.
Worksheets("Data Holder").Activate
With ActiveSheet.QueryTables.Add(Connection:=URL _
, Destination:=Range("$A$1"))
.Name = "Raw"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False