need to import a search result on webpage into a worksheet

ashwinivenkob

New Member
Joined
Oct 13, 2006
Messages
2
hello,

i wanted to know how i cud import a webpage into a worksheet using VBA.
After giving some criterias ,search result is displayed on a web page.
I want to open this web page directly as a worksheet in excel.

For Eg:
"http://ABC//XYZ.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&classification=&field0-0-0=noop&type0-0-0=noop&value0-0-0="

The above URL gives a search result.
How can the above URL's webpage be imported into Excel worksheet
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
In excel choose
Data > get external data > new web query > paste your URL (with search tags) and choose entire page and html option.

Your search results will be in excel
but you need to do a lot of clean up work after that

Ravi
 

ashwinivenkob

New Member
Joined
Oct 13, 2006
Messages
2
Thanks for the reply,

I did the steps given by you,i do get the webpage on excel.
As i need to automate the import,i need to know the VBA code during macro recording.
After recording the macros when i navigate to the VBA editor, instead of the code i can see only a message about when the macro was recorded.
How can i see the VBA code used during the recording of the macro.

Regards,
Ashwini
 

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
I tried to record a macro of importing data and it worked.
The following were the macro codes
Macro1 Macro
' Macro recorded 10/16/2006 by P N Maiya
'

'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.google.com/search?hl=kn&q=%22dinesh+baliga%22", Destination:= _
Range("C94"))
.Name = "search?hl=kn&q=%22dinesh+baliga%22_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
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.LargeScroll Down:=2
End Sub

give it a go again. it might work
Ravishankar
 

Watch MrExcel Video

Forum statistics

Threads
1,113,859
Messages
5,544,710
Members
410,631
Latest member
JFORTH97
Top