EscapeColumnName
(
String sColumnName
)
{
Debug.Assert( !String.IsNullOrEmpty(sColumnName) );
// From "Using structured references with Excel tables", here:
//
// http://office.microsoft.com/en-us/excel-help/using-structured-
// references-with-excel-tables-HA010155686.aspx
//
// "The following characters have special meaning and require the use
// of a single quotation mark (') as an escape character: Left bracket
// ([), right bracket (]), pound sign(#), and single quotation
// mark (')."
foreach ( String sSpecialCharacter in
new String [] {"'", "[", "]", "#"} )
{
sColumnName = sColumnName.Replace(sSpecialCharacter,
"'" + sSpecialCharacter);
}
return (sColumnName);
}