Access not opening Excel macro-enabled workbook
Posted on 2014-09-19
Although I think this is an Access question, I have included Excel just in case I am missing something.
I have an Access module that is supposted to open an autoexec macro-enabled Excel workbook. The workbook when opened via Excel does autostart and product the file expected. In Access I have also set a reference to the Excel library.
Below is the Access module that I have to process the Excel.xlsm. I can't determine why it isn't working or what might be missing to make it work.
Dim dbs As DAO.Database
Dim ExcelObj As Object 'Excel.Application
Dim objWB As Object 'Excel.Workbook
fPath = "C:\Links\"
Set dbs = CurrentDb
strFileName = fPath & "ContactMacro.xlsm"
On Error Resume Next
Set ExcelObj = GetObject(, "Excel.Application")
If ExcelObj Is Nothing Then
Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.EnableEvents = True
Set ExcelObj = Nothing