Hello everyone,
I have a very weird situation to deal with, and I'm absolutely stumped here. Didn't find anything through searching either.
My team has been tasked with testing some code that exports a query to Excel, and then creates a chart and does some more formatting.
On my machine, the code works perfectly. On another machine, there's an error that we can't seem to get past. It's a 429 run-time error - ActiveX component can't create object.
We've verified that we both have the same set of references enabled (many times). Neither of us have an ActiveX Data Objects Library or Microsoft Excel Library enabled. I'm stumped as to why one machine would give this 429 error, and the other wouldn't, since the code and references are identical.
Here's the code:
On the other machine, the error points to the GetObject line. On my machine, it executes that line without any issues, and all of the remaining code executes just fine.
This makes me very nervous, because I've used similar code in several projects, and I'm nervous that this error may rear its ugly head unexpectedly in customer environments, and cause all kinds of headaches.
Any thoughts on what might be different about the two machines to test? Thanks for reading!
I have a very weird situation to deal with, and I'm absolutely stumped here. Didn't find anything through searching either.
My team has been tasked with testing some code that exports a query to Excel, and then creates a chart and does some more formatting.
On my machine, the code works perfectly. On another machine, there's an error that we can't seem to get past. It's a 429 run-time error - ActiveX component can't create object.
We've verified that we both have the same set of references enabled (many times). Neither of us have an ActiveX Data Objects Library or Microsoft Excel Library enabled. I'm stumped as to why one machine would give this 429 error, and the other wouldn't, since the code and references are identical.
Here's the code:
Code:
Dim xl, xlsheet1 As Object
DoCmd.OutputTo acOutputQuery, QueryNameInput, acFormatXLSX, , True
Set xl = GetObject(, "Excel.Application") 'Error occurs here for other machine, but not on mine
Set xlsheet1 = xl.Worksheets(1)
With xlsheet1
.Rows("1:1").Font.Bold = True
.Columns.AutoFit
'etc etc
End With
With xl
.Application.Sheets("SheetName").Select
.Application.Charts.Add
.Application.ActiveChart.ChartType = 51 'xlColumnClustered
'etc etc
End With
On the other machine, the error points to the GetObject line. On my machine, it executes that line without any issues, and all of the remaining code executes just fine.
This makes me very nervous, because I've used similar code in several projects, and I'm nervous that this error may rear its ugly head unexpectedly in customer environments, and cause all kinds of headaches.
Any thoughts on what might be different about the two machines to test? Thanks for reading!