3
votes

I've been using ADO to process many Excel .xls and .xlsx workbooks without any problems. Recently I tried to process a .xlsm workbook to load to an Access database. The workbook contains several macros that are run every time a user opens a desktop version of Excel. The macros update "yesterdays" data with "todays" data. Unfortunately when I read the workbook programmatically ADO is returning "yesterdays" data. This means to me that the macros are not running when I open the workbook with ADO. Any suggestions. Hope I don't need to rewrite the code to open an instance of Excel to handle the workbook.

1

1 Answers

1
votes

ADO accesses only the data saved in the workbook. Nothing vba (or any other) code does dynamically when the workbook is opened in Excel is available. Excel macros can only run when the workbook is open in the application interface.

Either your process needs to duplicate what the macro(s) are doing in order to update the sheet data or, yes, indeed, you need to first open the workbook in the Excel environment and execute the macros, then SAVE the changes to the workbook.