Page 1 of 1

escape quote ComatePlus

Posted: Sun Jan 29, 2012 12:34 am
by malo
Hello

I have a worry when I want to save an Excel file whose name contains a quote '. with ComatePlus

example:

this code does not work
leFichierSave$= "ActiveWorkbook\SaveAs ('C:\Devis3\xx'test.xls')"
Exl \ GetObjectProperty (leFichierSave$)

this code works ok
leFichierSave$= "ActiveWorkbook\SaveAs ('C:\Devis3\xx_test.xls')"
Exl \ GetObjectProperty (leFichierSave$)

Thank you for your help

Re: escape quote ComatePlus

Posted: Sat Feb 11, 2012 1:39 pm
by spikey
You need to convert the single quote in the middle of the command to the escape sequence $0027 - but NOT the ones in proximity to the parentheses. Have a look in the help file under "COMatePlus command-strings"

This should work (although I haven't tested it):-
leFichierSave$= "ActiveWorkbook\SaveAs ('C:\Devis3\xx$0027test.xls')"

Re: escape quote ComatePlus

Posted: Sat Feb 11, 2012 4:02 pm
by IdeasVacuum
Hmm, there is no good reason to use meta-characters in file names. I would use StringReplace() to make the file name more sensible, especially if it has to travel anywhere.