Update - 1/20/2016 - I believe the answer posted by @Alistair is the correct one and I am working to verify.
Since my last post I tried repairing the Office 16 64 bit environment. Did not work.
To get this back to a solid starting point I have downgraded to Office 2013 (32 bit) on my regular Windows 10 machine. The code below works as expected. Next I am going to build another VM for the 2016 installs and see if the 32 bit version of Office 16 works.
Update - 1/19/2016 1658 PT - I am going to explore making the code aware of the 64 bit -vs- 32 bit environments. See: https://msdn.microsoft.com/en-us/library/office/gg264421.aspx
If that fixes the issue I'll update this question with the solution. Thank you!
***** Original post below **************************
This is while running a macro within MS Access that is to open an MS Project file and import data from the MS Project tasks to Access. The code below is a sample. The error we are getting is under Windows 10 & MS Office 2016. This error does not occur on another machine running Windows 7 & Office 2013; the MS Project versions are consistent to the Office versions.
We are getting an automation error when I attempt to instantiate a MSProject.Application object. The error is:
Run-time error '-2147467229 (80004023)':
Automation error A Microsoft Software Installer error was encountered
Here's the code:
Option Compare Database
Option Explicit
Sub test01()
Dim appMSProject As MSProject.Application
On Error GoTo ErrorHandler
'*** The next line is where we pop the error ***
Set appMSProject = New MSProject.Application
appMSProject.FileOpenEx Name:="C:\IMS\Project1.mpp"
'*** next line is just so I can see if something odd is going on ***
MsgBox (appMSProject.About())
appMSProject.Quit SaveChanges:=pjDoNotSave
Exit Sub
ErrorHandler:
MsgBox ("Error Number: " & Err.Number & vbCrLf & _
"Error Desc.: " & vbCrLf & _
Err.Description)
Exit Sub
End Sub
Interestingly while in debug mode if I delete "New" and step back into it, sometimes, it will run.
We have tried turning off prompts for logging into project server, project to project links, and set the macro security to the lowest settings on Access and Project. We have also tried this with different .MPP files in case the file was corrupt or possibly not compliant with MS Project 2016, which was a long shot since the file opens after the object instantiation of course.
I have also tried this technique:
Dim appMSProject As Object
...
Set appMSProject = CreateObject("MSProject.Application")
This yields the same error. I have even copied & pasted the code samples from here: https://msdn.microsoft.com/en-us/library/office/ff865152.aspx
An open switch here is the references. I am using the Microsoft Project 16 Object Library. The MSDN article specifies the Microsoft Project 15 Object Library. I have tried to find a newer MSDN article, specification, object model, or anything else that applies to Project 16. No joy.
While I find some very general automation error advice on-line almost all these examples are having problems after they spin up the Application object, not at the point I am having issues. There is also precious little help on MS Project VBA in general. It's a smaller community, of course. Just letting you know I looked.
All I can think is that I am missing a way to get hold of the Office 2016 / Project 2016 VBA documentation and in there is a new technique for instantiating the MSProject.Application object. If it's that simple and anyone knows the magic URL, please pass it along.
Thank you in advance! - jd