Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Help on macro coding fo URL

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Help on macro coding fo URL

Thank you very much for your suggestions

There is some error on the variable Mywebsite, could you please tell me how
to define it and assign value into it?
Should I define the Mywebsite as a string like following code?
Dim Mywebsite As String
Set Mywebsite = "http://www.stata.com/help.cgi?macro"
I try it, but error is still occurred.
Do you have any suggestions?
Thank you very much
Eric


"Rick Rothstein (MVP - VB)" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help on macro coding fo URL

I have not worked with query tables before, so I don't know for sure. What I
did is compare your non-working statement to your working one and noted a
missing quote mark. My best guess is to simply declare the Mywebsite
variable as a String (like you did), but do not use the Set keyword when
assigning the value to it (Set is used for objects, not simple variables).
I'd give this a try...

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

and see if it works.

Rick


"Eric" wrote in message
...
Thank you very much for your suggestions

There is some error on the variable Mywebsite, could you please tell me
how
to define it and assign value into it?
Should I define the Mywebsite as a string like following code?
Dim Mywebsite As String
Set Mywebsite = "http://www.stata.com/help.cgi?macro"
I try it, but error is still occurred.
Do you have any suggestions?
Thank you very much
Eric


"Rick Rothstein (MVP - VB)" wrote:

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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Help on macro coding fo URL

You forgot the .refresh and the dest needs to refer to the same sheet as the
query.

Sub getwebsitevariable()
myVariable = "http://www.stata.com/help.cgi?macro"
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & myVariable, _
Destination:=Range("A1"))
.Refresh BackgroundQuery:=False
End With


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
coding for macro murthy Excel Programming 0 March 4th 08 02:50 PM
Macro coding using GIF kami Excel Programming 1 October 13th 07 10:57 PM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
macro coding Andrew[_37_] Excel Programming 1 July 28th 04 06:06 AM
Macro Coding JulieB[_2_] Excel Programming 1 October 3rd 03 09:08 PM


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"