VBA web query with login

ChristianFast

New Member
Joined
Feb 4, 2014
Messages
8
Hi there, I'm trying to use a macro to get data from an XML document where I have to use a login.

The macro and workbook is intended for general users to search the document.
The macro will prompt you for a value, you type it in, you will then be prompted to login with username and password. The macro then uses your value as a parameter in the request and returns a table of info.

The last piece of the puzzle is to include the username and password in the VBA code, so that I don't get prompted for it everytime i run the macro. I just can't seem to find how to do that, I went to google university but, no luck.

I should make it clear that I dont know how to write code myself, I dont know what half the code actually does, I copy pieces from various sources to try and make my wishes happen.

I would be eternally grateful to anyone who tries to solve this.

The code:
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://TopSecretDocument.xml?maxSize=100&Value=[""QUOTE"",""Enter Value""]", _
Destination:=Range("a1"))

.TablesOnlyFromHTML = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False

End With
ActiveWorkbook.Connections("Connection").Delete
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,386
Messages
6,119,216
Members
448,876
Latest member
Solitario

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top