I keep getting the following error message:
1004: The macro 'ThisWorkbook.openForProcessing(false)' cannont be found
What is being done here is an Access DB is generating a series of spreadsheets. I'm not sure how it works but an already existing blank XLS file called "FormatFieldReports.xls" is opened thru Access using VBA code. The 'openForProcessing' is a Public procedure within the latter spreadsheet file. The 'ThisWorkbook' is an object within the file as well.
I have posted the code that opens the "FormatFieldReport.xls" file.
Anyone have any ideas?Code:Function formatXLFiles(userChoice As Boolean) Dim xlApp, myXLWrkBook As Object Dim databasePath Dim XLMacroPath databasePath = ExtractPath(CurrentDb.Name) XLMacroPath = databasePath & "\FormatFieldReports.xls" 'Open connection to Excel Workbook and make it visible Set xlApp = CreateObject("Excel.Application") Set myXLWrkBook = GetObject(XLMacroPath) myXLWrkBook.Application.Visible = True myXLWrkBook.Application.Windows(1).Visible = True 'Run procedure in ThisWorkBook folder If userChoice Then myXLWrkBook.Application.Run "ThisWorkbook.openForProcessing(true)" Else myXLWrkBook.Application.Run "ThisWorkbook.openForProcessing(false)" End If 'Close Automation object 'Either invoke the save method or set the Saved property to true to avoid a prompt about saving changes 'myXLWrkBook.Application.ActiveWorkbook.Save myXLWrkBook.Application.ActiveWorkbook.Saved = True myXLWrkBook.Application.ActiveWorkbook.Close Set myXLWrkBook = Nothing xlApp.Quit Set xlApp = Nothing End Function
Thanks,
Blake




Reply With Quote