ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Web Query (https://www.excelbanter.com/excel-programming/272047-excel-web-query.html)

DM

Excel Web Query
 
I am running into a problem with my web query. When ever
I attempt to run a web query with a url that is greater
than about 200 characters, the query fails.

There is a 218 character limit on the url length. Is
there anyway to modify this limit?

My URL's are so long because it is part of a large phone
directory.


Here is an example of url that is too long for the query
to function:

http://direct.srv.gc.ca/cgi-bin/dire...Ecn%3dAbraham%
5c%2c%20Michael%2cou%3dMC2586-MC2586%2cou%3dMC-MC%2cou%
3dOPS-OPS%2cou%3dASCDM-SMD%c9L%2cou%3dDM-SM%2cou%3dNCR-RCN%
2cou%3dIC-IC%2co%3dGC%2cc%3dCA

The code I am using is below:

Sub import()

'import Macro

Dim mybrowser As SHDocVw.InternetExplorer
Set mybrowser = GetObject(, "InternetExplorer.Application")
a = "URL;" & mybrowser.LocationURL
With ActiveSheet.QueryTables.Add(Connection:= _
a, Destination:=ActiveCell)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "2"
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

There is more code, but this is where the problem occurs,
once final line of the with statement is executed.

Don Guillett[_4_]

Excel Web Query
 
Pls keep in the original thread for maximum help.

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"DM" wrote in message
...
I am running into a problem with my web query. When ever
I attempt to run a web query with a url that is greater
than about 200 characters, the query fails.

There is a 218 character limit on the url length. Is
there anyway to modify this limit?

My URL's are so long because it is part of a large phone
directory.


Here is an example of url that is too long for the query
to function:

http://direct.srv.gc.ca/cgi-bin/dire...Ecn%3dAbraham%
5c%2c%20Michael%2cou%3dMC2586-MC2586%2cou%3dMC-MC%2cou%
3dOPS-OPS%2cou%3dASCDM-SMD%c9L%2cou%3dDM-SM%2cou%3dNCR-RCN%
2cou%3dIC-IC%2co%3dGC%2cc%3dCA

The code I am using is below:

Sub import()

'import Macro

Dim mybrowser As SHDocVw.InternetExplorer
Set mybrowser = GetObject(, "InternetExplorer.Application")
a = "URL;" & mybrowser.LocationURL
With ActiveSheet.QueryTables.Add(Connection:= _
a, Destination:=ActiveCell)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "2"
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

There is more code, but this is where the problem occurs,
once final line of the with statement is executed.





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com