Change in VBA library for Excel.workbook?

Mike Surridge 0 Reputation points
2024-11-13T17:50:24.2933333+00:00

I have an Access DB developed over several years in which there is a VBA module for exporting selected tables to a single, multi-worksheet Excel file.

After a Windows update this morning, the VBA module fails with a compilation error over this code fragment:

Set Excel = New Excel.Application

Set workbook = Excel.Workbooks.Add

workbook.Sheets("Sheet1").Delete

I am using the built in Visual Basic editor/debugger (via the Database Tools menu), which highlights the text '.Sheets' on the last line and displays the error message 'Method or data member not found'.

This was working yesterday before the Windows update, so I assume either (a) the update screwed up my Microsoft Office installation or (b) the update included some Microsoft Office library changes that mean I need to update my library references. The Visual Basic editor suggests I do have all the correct libraries selected under the 'Tools > References' option, though.

Does anyone know what went wrong, or how to fix it?

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
884 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.