W
Woody
I need to use the application.run method to invoke macros in workbooks I
create. Unfortunately, the workbooks can contain apostrophes in the file
name.
I tried double quoting the filename if it contains an apostrophe, but
that didn't work:
*double quote the file name if it contains an apostrophe
lcCAMNotebookFileName = loCAMNotebook.Name
IF CHR(39) $ lcCAMNotebookFileName
lcMacroName = [''] + lcCAMNotebookFileName + [''] + "!" +
EXCEL_MACRO_NAME
ELSE
lcMacroName = ['] + lcCAMNotebookFileName + ['] + "!" +
EXCEL_MACRO_NAME
ENDIF
*--run the Excel formatting macros
TRY
loExcelApp.Run( lcMacroName )
CATCH TO loErr
brserror( "couldn't find macro " + EXCEL_MACRO_NAME)
SET STEP ON
DEBUGOUT loerr.ErrorNo
DEBUGOUT loerr.Message
ENDTRY
create. Unfortunately, the workbooks can contain apostrophes in the file
name.
I tried double quoting the filename if it contains an apostrophe, but
that didn't work:
*double quote the file name if it contains an apostrophe
lcCAMNotebookFileName = loCAMNotebook.Name
IF CHR(39) $ lcCAMNotebookFileName
lcMacroName = [''] + lcCAMNotebookFileName + [''] + "!" +
EXCEL_MACRO_NAME
ELSE
lcMacroName = ['] + lcCAMNotebookFileName + ['] + "!" +
EXCEL_MACRO_NAME
ENDIF
*--run the Excel formatting macros
TRY
loExcelApp.Run( lcMacroName )
CATCH TO loErr
brserror( "couldn't find macro " + EXCEL_MACRO_NAME)
SET STEP ON
DEBUGOUT loerr.ErrorNo
DEBUGOUT loerr.Message
ENDTRY