RE: Single quotes in OnAction property of a button
- From: Joel <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 7 Apr 2008 11:42:02 -0700
Use replace and change one single quote to two single quotes
strMyFileName = replace(strMyFileName,"'","''")
"Ray C" wrote:
I have VBA code that adds buttons to a work***. In one instance I add a.
button and I assign a macro whereby it opens Windows Explorer to that file:
.OnAction = "'OpenExplorer """ & strMyFileName & """'"
The problem I have is that some files have apostrophe's in the file name.
And seeing that I need to put the OnAction property inside double-quotes and
the macro itself inside single quotes, I have a problem. Whenever a file has
a single quote in its name the code gives me an error.
Any suggestions?
- References:
- Single quotes in OnAction property of a button
- From: Ray C
- Single quotes in OnAction property of a button
- Prev by Date: Re: 1D Array Sort
- Next by Date: Need programming PROs help! Quiclk
- Previous by thread: Single quotes in OnAction property of a button
- Next by thread: Need programming PROs help! Quiclk
- Index(es):