0
votes

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

3
This might be a silly question but are you using the 32-bit or 64-bit versions of Access and Project? Is there a chance that you have the 64-bit version of Access and the 32-bit version of Project installed, or vice versa?Alistair McMillan
Stranger things have happened. I just confirmed everything is 64 bit. I have assumed the references would not be an issue (32 -v- 64), but, I think I'll do some research down that path as well. I s'pose I could have some funky references or a 32 bit library hanging around?? Worth a shot.JackW327
FWIW I checked out the reference. The file is MSPRJ.OLB and it's in C:\Program Files\Microsoft Office\root\Office16. My Office 16 install is 64 bit, so I believe the reference should be 64 bit as well. I can't find anything, yet, specific where I can identify the file as 64 bit like a file size, check sum, etc.JackW327
@AlistairMcMillan - Thank you! Your idea put me on to a path I had not considered. I've updated the question with what I found. Now I need to sort out how to implement a fix. Hopefully it works! It's a step in the right direction.JackW327
Just glancing through the article you linked above it doesn't look like this code is anywhere near complex enough to need to be updated. And given the error message you're getting I think it's just an install problem on your machine.Alistair McMillan

3 Answers

0
votes

I think this is a problem with the install of Microsoft Project 2016 on your machine.

I just tested your code here on a machine with Access 2016 and Project 2016 and it worked first time.

I'd recommend doing a repair install on Project and possibly Access as well.

0
votes

You might try installing KB3114538. Apparently some 2016 VBA objects properties were added but were not backwards compatible with older versions.

Making sure Project and Office are fully updated might be good as well.

Rod Gill Project MVP

0
votes

I had the same problem today when upgrading Office 2016 32-bit to 64-bit. All of my Outlook objects in VBA failed, resulting in the message "Automation Error: a Microsoft software installer error was encountered." I renamed the registry key associated with Outlook and on the next call it was apparently rebuilt, then everything started working again. More info at this link: https://support.microsoft.com/en-us/help/828550/you-receive-run-time-error-429-when-you-automate-office-applications No re-install of Office required in my case.