Does anyone have any suggestions what wrong is the variable - Mywebsite on
following coding? The url cannot be assigned into Mywebsite variable.

Does anyone have any suggestions?
Thank you very much for any suggestions
Eric

Dim Mywebsite As String
Set Mywebsite = "http://www.stata.com/help.cgi?macro"

With Sheets("Temp").QueryTables.Add(Connection:= _
"URL;" & Mywebsite & """", Destination:=Sheets("Temp").Range("$A$1"))

RE: What wrong with defined variable? by GarysStudent

GarysStudent
Sat Mar 15 05:58:00 CDT 2008

Instead of:
Set Mywebsite = "http://www.stata.com/help.cgi?macro"
use:
Mywebsite = "http://www.stata.com/help.cgi?macro"
--
Gary''s Student - gsnu200773

RE: What wrong with defined variable? by Eric

Eric
Sat Mar 15 09:15:00 CDT 2008

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


"Gary''s Student" wrote:

> Instead of:
> Set Mywebsite = "http://www.stata.com/help.cgi?macro"
> use:
> Mywebsite = "http://www.stata.com/help.cgi?macro"
> --
> Gary''s Student - gsnu200773

RE: What wrong with defined variable? by GarysStudent

GarysStudent
Sat Mar 15 09:37:01 CDT 2008

I don't see:
.Refresh BackgroundQuery:=False

in the post
--
Gary''s Student - gsnu200773


"Eric" wrote:

> 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
>
>
> "Gary''s Student" wrote:
>
> > Instead of:
> > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
> > use:
> > Mywebsite = "http://www.stata.com/help.cgi?macro"
> > --
> > Gary''s Student - gsnu200773

RE: What wrong with defined variable? by Eric

Eric
Sat Mar 15 09:49:02 CDT 2008

I forget the error has been fixed. Based on both following queries, the first
one can load the code for 1, but the second one cannot do it.
Do you have any suggestions on what wrong it is and how to solve it?
Thank you very much for your reply and suggestions
I look forward to your reply
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"))


"Gary''s Student" wrote:

> I don't see:
> .Refresh BackgroundQuery:=False
>
> in the post
> --
> Gary''s Student - gsnu200773
>
>
> "Eric" wrote:
>
> > 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
> >
> >
> > "Gary''s Student" wrote:
> >
> > > Instead of:
> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
> > > use:
> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
> > > --
> > > Gary''s Student - gsnu200773

RE: What wrong with defined variable? by Eric

Eric
Sat Mar 15 10:39:01 CDT 2008

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"))


"Gary''s Student" wrote:

> I don't see:
> .Refresh BackgroundQuery:=False
>
> in the post
> --
> Gary''s Student - gsnu200773
>
>
> "Eric" wrote:
>
> > 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
> >
> >
> > "Gary''s Student" wrote:
> >
> > > Instead of:
> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
> > > use:
> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
> > > --
> > > Gary''s Student - gsnu200773

Re: What wrong with defined variable? by Don

Don
Sat Mar 15 11:06:15 CDT 2008

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
dguillett1@austin.rr.com
"Eric" <Eric@discussions.microsoft.com> wrote in message
news:14DB83C2-6C45-4203-8C16-FE024E72AE92@microsoft.com...
> 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"))
>
>
> "Gary''s Student" wrote:
>
>> I don't see:
>> .Refresh BackgroundQuery:=False
>>
>> in the post
>> --
>> Gary''s Student - gsnu200773
>>
>>
>> "Eric" wrote:
>>
>> > 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
>> >
>> >
>> > "Gary''s Student" wrote:
>> >
>> > > Instead of:
>> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
>> > > use:
>> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
>> > > --
>> > > Gary''s Student - gsnu200773


Re: What wrong with defined variable? by Don

Don
Sat Mar 15 11:19:13 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_529B_01C8868E.65E89B00
Content-Type: text/plain;
format=flowed;
charset="Utf-8";
reply-type=response
Content-Transfer-Encoding: 7bit

5



HSBC HOLDINGS (5)


122.9 Open: 122.5 Volume: 16.41M P/E: 11.3
Day High: 124.1 Turnover: 2.02B Yield: 5.10%
0.40 (0.3%) Day Low: 122.2 52Wk High: 153.5 Mkt Cap: 1,449.06B
As of16:06 14 Mar 2008 Prev. Close: 122.5 52Wk Low: 104 NAV: 72.742
Bid: 122.7 Ask: 122.8 Board Lot: 400


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Don Guillett" <dguillett1@austin.rr.com> wrote in message
news:%23NLuAarhIHA.1212@TK2MSFTNGP05.phx.gbl...
> 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
> dguillett1@austin.rr.com
> "Eric" <Eric@discussions.microsoft.com> wrote in message
> news:14DB83C2-6C45-4203-8C16-FE024E72AE92@microsoft.com...
>> 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"))
>>
>>
>> "Gary''s Student" wrote:
>>
>>> I don't see:
>>> .Refresh BackgroundQuery:=False
>>>
>>> in the post
>>> --
>>> Gary''s Student - gsnu200773
>>>
>>>
>>> "Eric" wrote:
>>>
>>> > 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
>>> >
>>> >
>>> > "Gary''s Student" wrote:
>>> >
>>> > > Instead of:
>>> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
>>> > > use:
>>> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
>>> > > --
>>> > > Gary''s Student - gsnu200773
>

------=_NextPart_000_529B_01C8868E.65E89B00
Content-Type: image/gif;
name="clip_image001.gif"
Content-Transfer-Encoding: base64
Content-ID: <C490F14D1BC843DA82EE136CB22C4353@HP>

R0lGODlhjwAlAHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAACO
ACQAhQAAAAAAAA0KCA0LCw0LCg0IBD8LDT8GA2sLDWsIBGsEAGsGA5IDAJIKDZIGA5IDA5IGBLgI
DbgAA7gAALgGCLgEBLgDALgABNwAANwABNwAA9wGC9wDBNwGCtwGCP8AAP8ECv8ABP8ECP8EBP8D
CP8AA////wECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwEC
AwECAwECAwECAwECAwECAwECAwECAwECAwb/QEBgSCwaj8ikcslsOp/Q6NFErVqv2Kx2y+16v+Cw
2Docm8/otHpdXrvf8Di4La/b72i6V4D5fEBUAhkIeHUDDBGFVgQSDV16XAUhhIeAgoSKcIeJmSaM
jlyQWgQTnCYCGg2XnW+brJ+PAV+SmFaCCX6cBX5/pxkOfhuBfSKInhMfk1eCwB/Cq5eHFH0gfL2H
FcFUpMmEAhwWylW7fpa/2ibkI42xsyQGWHyAtKSJBSWqGML0pSYHHxFcHXhnS1+6SdAGHXpH6h2q
BgsN1BPoEIOpbf3u5ds3qZ4/fO28FCC4LJWvWp4aPTw5El69VbCqrLyUEIGrm4hcmVBQbVBK/1Um
R6k0eanlz5BdaMXzCa3PB3w1B8LbZM0PSJlMB9XEmWiTzgPVnD5V5XOZU6hZEUg9GkqWF48YI9Rc
+amm0Zdll3rTmparCa/Gdm5YhRXlKZN1095l1xbMAZAR7SpTgHYvAo//AhojHCgt5kl+AVfUnIhm
XipKKZO1jPnqFlFbyPU6efKQnw6Iap7qs84RN9edLfvz4+GCTWNcsaH77YgzFdsfcMtNu/uDB8av
3bISCmq7d6TfVyr9Tl4LbFb/xpZfj+U8+/fr3cOfv10+/fuF7OPfL0f/FtOGPReYXvxlEVN/2pnh
HBY6EfjGgm8caMtpYvinBYRWNLgMhWlguP+GhIXlkWAXVZXGlzdOdWXMLsJghQtAGHVzCjgdISNO
jCBZAxxt0TwAQTmo+dFbOryAwNwxMnphoUcAXsKkQohoZNY8oBkjFR8qJrJWiB6NF1xtDNS4QWsN
dFnZX1aS1Jg78BRWlJpoUhCULUSd+NNMPkmom559BQbWYt3dSR2IWVi4ZXCXHIomCQsAsqFlVY3V
FC/ArWKUhlsFNtICBMFS1ZmR7ljoiLHBCaBRVWwC4lyn6ZbFntjxCCUnf3Y6lG8qURfGkv08BCCT
qbiC6pfRbGanK87RldGNx2hZJUOlkJkaVCYhy2F7pP6X4kmTwoiTo8TmiUyOZR2ZIQMw6hgxKBXp
FXdcNs4MY10j0ElnWyLmglegdxqyYuG+cvTbyb8AazJgfVIkrPDCDDfs8BBBAAA7

------=_NextPart_000_529B_01C8868E.65E89B00--


Re: What wrong with defined variable? by Eric

Eric
Sat Mar 15 19:29:00 CDT 2008

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

"Don Guillett" wrote:

> 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
> dguillett1@austin.rr.com
> "Eric" <Eric@discussions.microsoft.com> wrote in message
> news:14DB83C2-6C45-4203-8C16-FE024E72AE92@microsoft.com...
> > 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"))
> >
> >
> > "Gary''s Student" wrote:
> >
> >> I don't see:
> >> .Refresh BackgroundQuery:=False
> >>
> >> in the post
> >> --
> >> Gary''s Student - gsnu200773
> >>
> >>
> >> "Eric" wrote:
> >>
> >> > 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
> >> >
> >> >
> >> > "Gary''s Student" wrote:
> >> >
> >> > > Instead of:
> >> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
> >> > > use:
> >> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
> >> > > --
> >> > > Gary''s Student - gsnu200773
>
>

Re: What wrong with defined variable? by Don

Don
Sat Mar 15 19:41:40 CDT 2008


In this case the variable is NOT text but it would work the same way.

One such example where [sym] is a defined named range. Can also work for a
string for a loop.
"URL;http://finance.yahoo.com/q?s=" & [Sym]

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Eric" <Eric@discussions.microsoft.com> wrote in message
news:1239E443-B370-4167-9CD9-920E334F7375@microsoft.com...
> 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
>
> "Don Guillett" wrote:
>
>> 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
>> dguillett1@austin.rr.com
>> "Eric" <Eric@discussions.microsoft.com> wrote in message
>> news:14DB83C2-6C45-4203-8C16-FE024E72AE92@microsoft.com...
>> > 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"))
>> >
>> >
>> > "Gary''s Student" wrote:
>> >
>> >> I don't see:
>> >> .Refresh BackgroundQuery:=False
>> >>
>> >> in the post
>> >> --
>> >> Gary''s Student - gsnu200773
>> >>
>> >>
>> >> "Eric" wrote:
>> >>
>> >> > 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
>> >> >
>> >> >
>> >> > "Gary''s Student" wrote:
>> >> >
>> >> > > Instead of:
>> >> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
>> >> > > use:
>> >> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
>> >> > > --
>> >> > > Gary''s Student - gsnu200773
>>
>>


Re: What wrong with defined variable? by Eric

Eric
Sat Mar 15 20:46:00 CDT 2008

Thank everyone very much for suggestions
Could you please give me any suggestions on what the sign "_" do in the query?
Why do I need sign "_" on number for variable? but
I don't need sign "_" on string for variable.

Thank you very much for any suggestions
Eric

"Don Guillett" wrote:

>
> In this case the variable is NOT text but it would work the same way.
>
> One such example where [sym] is a defined named range. Can also work for a
> string for a loop.
> "URL;http://finance.yahoo.com/q?s=" & [Sym]
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguillett1@austin.rr.com
> "Eric" <Eric@discussions.microsoft.com> wrote in message
> news:1239E443-B370-4167-9CD9-920E334F7375@microsoft.com...
> > 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
> >
> > "Don Guillett" wrote:
> >
> >> 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
> >> dguillett1@austin.rr.com
> >> "Eric" <Eric@discussions.microsoft.com> wrote in message
> >> news:14DB83C2-6C45-4203-8C16-FE024E72AE92@microsoft.com...
> >> > 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"))
> >> >
> >> >
> >> > "Gary''s Student" wrote:
> >> >
> >> >> I don't see:
> >> >> .Refresh BackgroundQuery:=False
> >> >>
> >> >> in the post
> >> >> --
> >> >> Gary''s Student - gsnu200773
> >> >>
> >> >>
> >> >> "Eric" wrote:
> >> >>
> >> >> > 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
> >> >> >
> >> >> >
> >> >> > "Gary''s Student" wrote:
> >> >> >
> >> >> > > Instead of:
> >> >> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
> >> >> > > use:
> >> >> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
> >> >> > > --
> >> >> > > Gary''s Student - gsnu200773
> >>
> >>
>
>

Re: What wrong with defined variable? by Mike

Mike
Sat Mar 15 21:35:22 CDT 2008

Eric -

From Microsoft Visual Basic Help:

"line-continuation character

The combination of a space followed by an underscore ( _) used in the
development environment to extend a single logical line of code to two or
more physical lines. However, you can't use a line-continuation character to
continue a line of code within a string expression."

- Mike Middleton
http://www.DecisionToolworks.com
Decision Analysis Add-ins for Excel



"Eric" <Eric@discussions.microsoft.com> wrote in message
news:8DA04D92-178D-4598-A7CC-54C039B946BB@microsoft.com...
> Thank everyone very much for suggestions
> Could you please give me any suggestions on what the sign "_" do in the
> query?
> Why do I need sign "_" on number for variable? but
> I don't need sign "_" on string for variable.
>
> Thank you very much for any suggestions
> Eric
>
> "Don Guillett" wrote:
>
>>
>> In this case the variable is NOT text but it would work the same way.
>>
>> One such example where [sym] is a defined named range. Can also work for
>> a
>> string for a loop.
>> "URL;http://finance.yahoo.com/q?s=" & [Sym]
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguillett1@austin.rr.com
>> "Eric" <Eric@discussions.microsoft.com> wrote in message
>> news:1239E443-B370-4167-9CD9-920E334F7375@microsoft.com...
>> > 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
>> >
>> > "Don Guillett" wrote:
>> >
>> >> 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
>> >> dguillett1@austin.rr.com
>> >> "Eric" <Eric@discussions.microsoft.com> wrote in message
>> >> news:14DB83C2-6C45-4203-8C16-FE024E72AE92@microsoft.com...
>> >> > 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"))
>> >> >
>> >> >
>> >> > "Gary''s Student" wrote:
>> >> >
>> >> >> I don't see:
>> >> >> .Refresh BackgroundQuery:=False
>> >> >>
>> >> >> in the post
>> >> >> --
>> >> >> Gary''s Student - gsnu200773
>> >> >>
>> >> >>
>> >> >> "Eric" wrote:
>> >> >>
>> >> >> > 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
>> >> >> >
>> >> >> >
>> >> >> > "Gary''s Student" wrote:
>> >> >> >
>> >> >> > > Instead of:
>> >> >> > > Set Mywebsite = "http://www.stata.com/help.cgi?macro"
>> >> >> > > use:
>> >> >> > > Mywebsite = "http://www.stata.com/help.cgi?macro"
>> >> >> > > --
>> >> >> > > Gary''s Student - gsnu200773
>> >>
>> >>
>>
>>