PC Review


Reply
Thread Tools Rate Thread

Access to web tables

 
 
=?Utf-8?B?U2NvdHQ=?=
Guest
Posts: n/a
 
      7th Aug 2007
I need to pull information from web and put them in Column F. The site
address are listed in A1:A5. Followings are the codes. When I run them, I get
a message "Invalid Web Query". Out of the 5 queries, 1 or 2 open up incorrect
web pages and cannot tell which ones will be correct and which ones will be
incorrect beforehand. Anyone can tell me what happened and how to fix the
problem?

Sub Webvalue()

Dim c As Range
Dim str As String
Dim i As Integer

i = 0
For Each c In ThisWorkbook.Sheets("Sheet2").Range("A1:A5")
c.Select
str = "URL;" & Selection.Hyperlinks(1).Address

With ActiveSheet.QueryTables.Add(Connection:=str,
Destination:=Range("F1").Offset(i, 0))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebFormatting = xlNone
.WebSelectionType = xlSpecifiedTables
.WebTables = "2,4,5,6"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
.Refresh
End With
i = i + 30
Next c
End Sub

 
Reply With Quote
 
 
 
 
Randy Harmelink
Guest
Posts: n/a
 
      7th Aug 2007
It may depend entirely upon the URLs you're running against, which you
haven't shown us. Can I assume all the web pages are from the same
web site and in the same format? If not, the:

.WebTables = "2,4,5,6"

....statement makes no sense, as that would be extracting the exact
same tables, based on relative page location, off of every URL you run
a query against. If the pages don't have the same format, that
wouldn't work very well.

Also, I've seen instances where web pages can be written to defeat the
Web Query process, so you could also have problems if your URLs are
going against such pages.

On Aug 7, 9:32 am, Scott <Sc...@discussions.microsoft.com> wrote:
> I need to pull information from web and put them in Column F. The site
> address are listed in A1:A5. Followings are the codes. When I run them, I get
> a message "Invalid Web Query". Out of the 5 queries, 1 or 2 open up incorrect
> web pages and cannot tell which ones will be correct and which ones will be
> incorrect beforehand. Anyone can tell me what happened and how to fix the
> problem?


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Access tables to Access Project with SQL Server tables Kaykayme Microsoft Access External Data 5 26th Jan 2009 07:59 PM
Creating archive tables for Access tables joined to Sybase tables =?Utf-8?B?QXJjaGl2ZSBUYWJsZXM=?= Microsoft Access External Data 0 11th Jan 2006 10:31 PM
Linking Access tables to SQL Server tables with keys in Binary =?Utf-8?B?QnVzdGVyIEM=?= Microsoft Access External Data 1 26th May 2005 03:21 AM
Linking Access 97 tables to Access 2002 tables michaelwoodard Microsoft Access Database Table Design 2 13th Aug 2004 02:43 AM
Access 2003: Linked Tables Manager don't show tables Morten Microsoft Access External Data 3 14th Feb 2004 03:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:46 PM.