View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1473_] Rick Rothstein \(MVP - VB\)[_1473_] is offline
external usenet poster
 
Posts: 1
Default Help on macro coding fo URL

I think you are missing an evaluated quote mark after your variable name.
See if this one works for you...

myVariable = "http://www.stata.com/help.cgi?macro"
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & myVariable & """", _
Destination:=sheets("Temp").Range("A1"))

Note the 4 quote marks... that should evaluate to a single trailing quote
mark when the statement is evaluated.

Rick


"Eric" wrote in message
...
Refering to the post under Excel Worksheet Functions

Does anyone have any suggestions on following macro coding?

[Working]
With Sheets("Temp").QueryTables.Add(Connection:= _
"URL;http://www.stata.com/help.cgi?macro",
Destination:=Sheets("Temp").Range("$A$1"))

[Not working]
myVariable = "http://www.stata.com/help.cgi?macro"
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & myVariable, _
Destination:=sheets("Temp").Range("A1"))

It seems to me that
"URL;" & myVariable is not equal to
"URL;http://www.stata.com/help.cgi?macro".

Do anyone have any suggestions on how to solve it?
Thank you very much for any suggestions
Eric