Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Not working... Why? ActiveSheet.QueryTables.Add(Connection:=ActiveCell .Offset(0,

Hi! Here is the code I am using...I don't understand why it's not
working. In ActiveCell.Offset(0, -1) I have a list of URLs. I need for
the results of the query to be dropped in the ActiveCell.Address. It
keeps crashing on me. It's complaining of the following...

Run-time error '1004':
Application-defined or object-defined error


ActiveCell.Offset(1, 0).Select
With ActiveSheet.QueryTables.Add(Connection:=ActiveCell .Offset(0,
-1).Value, Destination:=Range(ActiveCell.Address))
.Name = "csv"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default Not working... Why? ActiveSheet.QueryTables.Add(Connection:=ActiveCell .Offset(0,

On Mar 27, 3:58*am, wrote:
Hi! Here is the code I am using...I don't understand why it's not
working. In ActiveCell.Offset(0, -1) I have a list of URLs. I need for
the results of the query to be dropped in the ActiveCell.Address. It
keeps crashing on me. It's complaining of the following...

Run-time error '1004':
Application-defined or object-defined error

* * ActiveCell.Offset(1, 0).Select
* * With ActiveSheet.QueryTables.Add(Connection:=ActiveCell .Offset(0,
-1).Value, Destination:=Range(ActiveCell.Address))
* * * * .Name = "csv"
* * * * .FieldNames = True
* * * * .RowNumbers = False
* * * * .FillAdjacentFormulas = False
* * * * .PreserveFormatting = True
* * * * .RefreshOnFileOpen = False
* * * * .BackgroundQuery = True
* * * * .RefreshStyle = xlInsertDeleteCells
* * * * .SavePassword = False
* * * * .SaveData = True
* * * * .AdjustColumnWidth = True
* * * * .RefreshPeriod = 0
* * * * .WebSelectionType = xlAllTables
* * * * .WebFormatting = xlWebFormattingNone
* * * * .WebPreFormattedTextToColumns = True
* * * * .WebConsecutiveDelimitersAsOne = True
* * * * .WebSingleBlockTextImport = False
* * * * .WebDisableDateRecognition = False
* * * * .WebDisableRedirections = False
* * * * .Refresh BackgroundQuery:=False
* * End With


Hi,
Assuming that you have url as http://www.abcxyz.com/
First line of your code should be as below.
With ActiveSheet.QueryTables.Add(Connection:="URL;" &
ActiveCell.Offset(0, _
-1).Value, Destination:=Range(ActiveCell.Address))

I have only added "URL;" & in your connection string.

Hope this helps.

Regards,
Madiya
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Not working... Why? ActiveSheet.QueryTables.Add(Connection:=ActiveCell .Offset(0,

Hi,

It looks like you are just sending QueryTables a raw url as the
connection string from your description / example. You might want to
try something along the lines of:

With ActiveSheet.QueryTables.Add(Connection:="URL;" & ActiveCell. _
Offset(0,-1).Value, Destination:=Range(ActiveCell.Address))

This should format your url correctly as a connection string. Without
knowing what your URL will return, I can't comment on the rest.

Cheers,
Ivan.


On Mar 27, 9:58*am, wrote:
Hi! Here is the code I am using...I don't understand why it's not
working. In ActiveCell.Offset(0, -1) I have a list of URLs. I need for
the results of the query to be dropped in the ActiveCell.Address. It
keeps crashing on me. It's complaining of the following...

Run-time error '1004':
Application-defined or object-defined error

* * ActiveCell.Offset(1, 0).Select
* * With ActiveSheet.QueryTables.Add(Connection:=ActiveCell .Offset(0,
-1).Value, Destination:=Range(ActiveCell.Address))
* * * * .Name = "csv"
* * * * .FieldNames = True
* * * * .RowNumbers = False
* * * * .FillAdjacentFormulas = False
* * * * .PreserveFormatting = True
* * * * .RefreshOnFileOpen = False
* * * * .BackgroundQuery = True
* * * * .RefreshStyle = xlInsertDeleteCells
* * * * .SavePassword = False
* * * * .SaveData = True
* * * * .AdjustColumnWidth = True
* * * * .RefreshPeriod = 0
* * * * .WebSelectionType = xlAllTables
* * * * .WebFormatting = xlWebFormattingNone
* * * * .WebPreFormattedTextToColumns = True
* * * * .WebConsecutiveDelimitersAsOne = True
* * * * .WebSingleBlockTextImport = False
* * * * .WebDisableDateRecognition = False
* * * * .WebDisableRedirections = False
* * * * .Refresh BackgroundQuery:=False
* * End With


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveSheet.QueryTables.Add David Excel Programming 0 March 10th 08 10:39 PM
ActiveSheet.QueryTables.Add Rick Excel Programming 4 November 10th 05 04:24 AM
ActiveSheet.QueryTables.Add quartz[_2_] Excel Programming 0 November 9th 05 07:18 PM
help with ActiveSheet.QueryTables.Add Connection: uriel78 Excel Programming 1 March 6th 05 04:08 PM
With ActiveSheet.QueryTables.Add [email protected] Excel Programming 4 January 6th 04 04:58 PM


All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"