hgj1357
asked on
Excel " symbol in a text string
I am creating a VBA to open multiole CSV files and process the contents.
I am using excel to generate the VBA code then pasting it into excel's VBA
I'm running into problems with the " symbol
I need to be able to enter this text field:
Workbooks.OpenText Filename:="X:\Projects\Dat a\01.txt"
However, I'd like to be able to have a column of numbers: 1,2,3,4...etc and use
="Workbooks.OpenText Filename:="X:\Projects\Dat a\" & format(A1,"00") & ".txt"
However, the " symbol in the string prevents this from working.
I can use @ instead of "
="Workbooks.OpenText Filename:=@X:\Projects\Dat a\" & format(A1,"00") & ".txt@"
Then use a text editor to replace @ with " but I'd like a more elegant solution as this will be used to add ~ ½ million data points.
I am using excel to generate the VBA code then pasting it into excel's VBA
I'm running into problems with the " symbol
I need to be able to enter this text field:
Workbooks.OpenText Filename:="X:\Projects\Dat
However, I'd like to be able to have a column of numbers: 1,2,3,4...etc and use
="Workbooks.OpenText Filename:="X:\Projects\Dat
However, the " symbol in the string prevents this from working.
I can use @ instead of "
="Workbooks.OpenText Filename:=@X:\Projects\Dat
Then use a text editor to replace @ with " but I'd like a more elegant solution as this will be used to add ~ ½ million data points.
If you want literal "s then you need to double them up, try
="Workbooks.OpenText Filename:=""X:\Projects\Da ta\" & format(A1,"00") & ".txt"""
regards, barry
="Workbooks.OpenText Filename:=""X:\Projects\Da
regards, barry
ASKER
Nope. Neither of these work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry hgj1357 I'm only a part-timer with VBA!
Jeez NBVC, we need some proper VBA people in here.......
regards, barry
Jeez NBVC, we need some proper VBA people in here.......
regards, barry
So true, barry! It's funny how we both came up with the exact same suggestion! Just shows where we stand with VBA. ROFL!
ASKER
I should have spent more time on it before posting.
="Workbooks.OpenText Filename:=""X:\Projects\Da