Lev Seltzer
asked on
MS Access 2007 Macro no longer works
I had a problem some time ago with a macro, which I reported here:
https://www.experts-exchange.com/questions/28261009/MS-Access-Macro-no-longer-works.html
The solution worked for a while, but my system stopped working and I had to reinstall Windows 8.1 and all applications, and now the macro does not work.
As before, I have confirmed that the reference to the Microsoft Excel 15.0 Object Library is checked.
The error is
Run-time error '429':
ActiveX component can't create object
I do not know what to do now to get this to work.
At the same time, when I open the project (ADP file) I am told that it is in read-only mode, even though the folder e:\my documents has been listed as a "trusted zone". I saved the file with a different name (same folder), and am now working with that, but perhaps this is related.
Thank you.
https://www.experts-exchange.com/questions/28261009/MS-Access-Macro-no-longer-works.html
The solution worked for a while, but my system stopped working and I had to reinstall Windows 8.1 and all applications, and now the macro does not work.
As before, I have confirmed that the reference to the Microsoft Excel 15.0 Object Library is checked.
Option Compare Database
Function ExportToIMM()
Dim filepath As String, xlapp As Object, xldoc As Object
filepath = "C:\Users\Lev\Desktop\ATR.xls"
filepath2 = "C:\Users\Lev\Desktop\ATR.txt"
DoCmd.OutputTo acOutputTable, "RecentlySentAnswers", acFormatXLS, filepath
Set xlapp = CreateObject("Excel.Application")
Set xldoc = xlapp.Workbooks.Open(filepath)
xlapp.DisplayAlerts = True
xldoc.SaveAs filepath2, xlCSV
xldoc.Close False
xlapp.Quit
deedCSV = 1
End Function
The error is
Run-time error '429':
ActiveX component can't create object
I do not know what to do now to get this to work.
At the same time, when I open the project (ADP file) I am told that it is in read-only mode, even though the folder e:\my documents has been listed as a "trusted zone". I saved the file with a different name (same folder), and am now working with that, but perhaps this is related.
Thank you.
Is the excel file open when you are running the macro?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I ran detect and repair for Office 2007 (for Access) and Office 2013 (for Excel) and without any further modification the macro works perfectly.
I do not know what was wrong but thank you for the tip, as it was all I needed to get things working again.
I do not know what was wrong but thank you for the tip, as it was all I needed to get things working again.