ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax error? (https://www.excelbanter.com/excel-programming/429777-syntax-error.html)

David

Syntax error?
 
Hi Group,

I must have a syntax error here, but can not figure it out:
myurl =
"=http://moneycentral.msn.com/investor/invsub/results/statemnt.aspx?Symbol="
& Symbol _
& "&lstStatement=Income&stmtView=Qtr"
Set QT = ActiveSheet.QueryTables.Add( _
Connection:="URL;" & myurl, _
Destination:=Range("B1"))
With QT
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.PreserveFormatting = True
.WebSelectionType = xlSpecifiedTables
.WebTables = "8"
.Refresh BackgroundQuery:=False
End With

Thanks,
David

Peter T

Syntax error?
 
This doesn't look right
Symbol= & Symbol

This worked for me with the rest of your code (without the = prefix)

myurl = "http://moneycentral.msn.com/investor/invsub/" & _
"results/statemnt.aspx?Symbol=PFE" _
& "&lstStatement=Income&stmtView=Qtr"

Regards,
Peter T


"David" wrote in message
...
Hi Group,

I must have a syntax error here, but can not figure it out:
myurl =
"=http://moneycentral.msn.com/investor/invsub/results/statemnt.aspx?Symbol="
& Symbol _
& "&lstStatement=Income&stmtView=Qtr"
Set QT = ActiveSheet.QueryTables.Add( _
Connection:="URL;" & myurl, _
Destination:=Range("B1"))
With QT
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.PreserveFormatting = True
.WebSelectionType = xlSpecifiedTables
.WebTables = "8"
.Refresh BackgroundQuery:=False
End With

Thanks,
David




David

Syntax error?
 
Hi peter,

I would have stared at it for hours and not seen the syntax error. Thanks
for your help.

Thx,
David

"Peter T" wrote:

This doesn't look right
Symbol= & Symbol

This worked for me with the rest of your code (without the = prefix)

myurl = "http://moneycentral.msn.com/investor/invsub/" & _
"results/statemnt.aspx?Symbol=PFE" _
& "&lstStatement=Income&stmtView=Qtr"

Regards,
Peter T


"David" wrote in message
...
Hi Group,

I must have a syntax error here, but can not figure it out:
myurl =
"=http://moneycentral.msn.com/investor/invsub/results/statemnt.aspx?Symbol="
& Symbol _
& "&lstStatement=Income&stmtView=Qtr"
Set QT = ActiveSheet.QueryTables.Add( _
Connection:="URL;" & myurl, _
Destination:=Range("B1"))
With QT
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.PreserveFormatting = True
.WebSelectionType = xlSpecifiedTables
.WebTables = "8"
.Refresh BackgroundQuery:=False
End With

Thanks,
David






All times are GMT +1. The time now is 10:18 AM.

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