Is it possible to run a view source code query on VBA in Excel?

Spyros13

Board Regular
Joined
Mar 12, 2014
Messages
175
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Like this:

Sub addsSourceCode()

For x = 1 To 5
Worksheets("Combined").Select
Worksheets("Combined").Activate

mystr = "Url;view-source:jolly.house.gov/contact"

mystr = Cells(x, 3)
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "scode" & x
With ActiveSheet.QueryTables.Add(Connection:=mystr, Destination:=Range("$A$2"))


CommandType = 0
.Name = Cells(x, 1)
FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.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
Next x
End Sub

I've run it, and if there was an actual www or url in place it would produce the page on each sheet, but all it gives me are 5 new blank sheets sc1 ... sc5

what I want is the Source Code in these sheets
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Ive got 8 websites, with viewsource: in front of each one in row C ofcourse.
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,692
Members
449,331
Latest member
smckenzie2016

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