ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Time Error (https://www.excelbanter.com/excel-programming/357708-run-time-error.html)

gunny1979[_4_]

Run Time Error
 

Hi,

Im getting a run time error 13 for the code below!! it says Type
Mismatch.

can anyone see why, i cant!!




Sub getit()

'use this once and then refresh
myurl =
"http://www.all-hotels.com/xbook/servlet/DisplayRates?show=&partner=8&hotl_id=162382&type=a book&filter=&splurgeUrl=yes&txtArrivalDate1="
+ Sheets("Sheet2").Range("B11") + "&txtDepartureDate1=" +
Sheets("Sheet2").Range("B12") +
"&locationID=450210&hotel_name=&lastLocation=Farnb orough&cboArrivalMonths="
+ Sheets("Sheet2").Range("B19") + "&cboArrivalDays=10&cboNights=" +
Sheets("Sheet2").Range("B20") +
"&number_of_adults1=2&number_of_children1=0&number _of_beds1=1"






With
ActiveWorkbook.Worksheets("test").QueryTables.Add( Connection:="URL;" &
myurl, Destination:=Worksheets("test").Cells(1, 1))

FieldNames = True
RowNumbers = False
FillAdjacentFormulas = False
PreserveFormatting = True
RefreshOnFileOpen = False
BackgroundQuery = True
RefreshStyle = xlInsertDeleteCells
SaveData = True
AdjustColumnWidth = True
RefreshPeriod = 0
WebPreFormattedTextToColumns = True
WebSingleBlockTextImport = False
WebDisableDateRecognition = False
WebDisableRedirections = False
Refresh BackgroundQuery:=False
End With
End Sub


--
gunny1979
------------------------------------------------------------------------
gunny1979's Profile: http://www.excelforum.com/member.php...o&userid=32932
View this thread: http://www.excelforum.com/showthread...hreadid=528666


Tom Ogilvy

Run Time Error
 
Try changine the "+" sign to "&"

--
Regards,
Tom Ogilvy


"gunny1979" wrote:


Hi,

Im getting a run time error 13 for the code below!! it says Type
Mismatch.

can anyone see why, i cant!!




Sub getit()

'use this once and then refresh
myurl =
"http://www.all-hotels.com/xbook/servlet/DisplayRates?show=&partner=8&hotl_id=162382&type=a book&filter=&splurgeUrl=yes&txtArrivalDate1="
+ Sheets("Sheet2").Range("B11") + "&txtDepartureDate1=" +
Sheets("Sheet2").Range("B12") +
"&locationID=450210&hotel_name=&lastLocation=Farnb orough&cboArrivalMonths="
+ Sheets("Sheet2").Range("B19") + "&cboArrivalDays=10&cboNights=" +
Sheets("Sheet2").Range("B20") +
"&number_of_adults1=2&number_of_children1=0&number _of_beds1=1"






With
ActiveWorkbook.Worksheets("test").QueryTables.Add( Connection:="URL;" &
myurl, Destination:=Worksheets("test").Cells(1, 1))

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebPreFormattedTextToColumns = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub


--
gunny1979
------------------------------------------------------------------------
gunny1979's Profile: http://www.excelforum.com/member.php...o&userid=32932
View this thread: http://www.excelforum.com/showthread...hreadid=528666




All times are GMT +1. The time now is 07:32 PM.

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