Quote marks and variables

S

Sharon

I know you have already given me the answer on this but I just can't find it
and am going nuts here. I have three variables
MyPath = network path name - string
MyCountry = country name -string
Myfile - file name - string

When I try the statement it just wont work
MyImport = "MyPath&MyCountry&MyFile"

Any help would be very much appreciated
 
T

tina

assuming that MyImport is a String variable also, the correct syntax would
be

MyImport = MyPath & MyCountry & MyFile

hth
 
D

Douglas J. Steele

Why are you putting the quotes? Is it because you want quotes around the
concatenated values of the variables?

If so, you need

MyImport = """" & MyPath&MyCountry&MyFile & """"

or

MyImport = Chr$(34) & MyPath&MyCountry&MyFile & Chr$(34)

Other than that, you don't want the quotes: as you've doubtlessly
discovered, doing so sets MyImport to the literal string
MyPath&MyCountry&MyFile
 
F

fredg

I know you have already given me the answer on this but I just can't find it
and am going nuts here. I have three variables
MyPath = network path name - string
MyCountry = country name -string
Myfile - file name - string

When I try the statement it just wont work
MyImport = "MyPath&MyCountry&MyFile"

Any help would be very much appreciated

Remove the quotes.

MyImport = MyPath & MyCountry & MyFile

If the individual strings do not include the "\" separator, then:

MyImport = MyPath & "\" & MyCountry & "\" & MyFile
 
Top