escape quote ComatePlus

Just starting out? Need help? Post your questions and find answers here.
malo
User
User
Posts: 22
Joined: Mon Sep 28, 2009 5:19 pm

escape quote ComatePlus

Post 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
User avatar
spikey
Addict
Addict
Posts: 810
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: escape quote ComatePlus

Post 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')"
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: escape quote ComatePlus

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply