Thank everyone very much for suggestions
Could you please tell me what if the variable is a text?
How can I insert the variable into query?
Thank everyone very much
Eric
:
This is the way to insert your variable. In this case the variable has
to
be
a number
If you need additional help on a project, you may contact me
privately. I
am
a retired series 7 stockbroker.
I do this sort of thing for my clients on a daily basis. You really
don't
want to ADD a new connecition. What you want to do is REFRESH an
existing
with the variable. Or, variables in a loop.
mycode = 3
With ActiveSheet.QueryTables.Add(Connection:="URL;" & _
"
http://www.quamnet.com/quote.action?quoteSectionCode=&stockCode=" _
& mycode, Destination:=Range("A5"))
'As I said earlier, you must have this line
.Refresh BackgroundQuery:=False
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
It seems to me that the query for url has been changed if the URL is
combined
together. Do you have any suggestions on what wrong the url is by
combining
Mywebsite to form the query.
Thank you very much for suggestions
Eric
[Can load the code = 1]
With Sheets("Temp").QueryTables.Add(Connection:= _
"URL;
http://www.quamnet.com/quote.action?quoteSectionCode=&stockCode=1",
Destination:=Sheets("Temp").Range("$A$1"))
[Cannot load the code = 1]
Mywebsite = 1
With Sheets("Temp").QueryTables.Add(Connection:= _
"URL;
http://www.quamnet.com/quote.action?quoteSectionCode=&stockCode="
&
Mywebsite & """", Destination:=Sheets("Temp").Range("$A$1"))
:
I don't see:
.Refresh BackgroundQuery:=False
in the post
--
Gary''s Student - gsnu200773
:
Thank you very much for your suggestion
Do you have any suggestions on following error? and do you have
any
suggestions on how to fix it?
Thank you very much for any suggestions
Eric
[Working]
With Sheets("Temp").QueryTables.Add(Connection:= _
"URL;
http://www.quamnet.com/quote.action?quoteSectionCode=&stockCode=1",
Destination:=Sheets("Temp").Range("$A$1"))
[Not working]
Mywebsite = 1
With Sheets("Temp").QueryTables.Add(Connection:= _
"URL;
http://www.quamnet.com/quote.action?quoteSectionCode=&stockCode="
&
Mywebsite & """", Destination:=Sheets("Temp").Range("$A$1"))
Error pointing to
.Refresh BackgroundQuery:=False
:
Instead of:
Set Mywebsite = "
http://www.stata.com/help.cgi?macro"
use:
Mywebsite = "
http://www.stata.com/help.cgi?macro"