I am writing a VBA script in Excel that, upon clicking a button, will open a user-selected project file, initiate an export using a pre-setup map to an Excel file, close the project, pull the data from that exported intermediary file into where it needs to go in the Excel file where the script is called from, and then delete the intermediary file.
My code is working, but there is one non-ideal issue that I need help resolving. Right now, my code can create the temporary intermediary file in an .xls format only, which is an older format. But the project application that gets loaded on our computers tells me that loading or saving in older formats is not allowed. Anyone that wants to use my automation will need to open their local copy of the project, go into the trust center, and check the box allowing for saving in older formats.
If I can find a way to modify my code so that when the intermediary file is created, it is created with a modern .xlsx instead of an older .xls, I think that my code will run without the user needing to do anything.
It seems that the file format is determined by the FormatID parameter of the project.FileSaveAs() method. When I go to Microsoft's documentation online, it says that I should be using "MSProject.xls", but that doesn't work for me. After a bunch of searching, someone tipped me off to use "MSProject.xls8" instead, which got things working creating an .xls file.
Does anyone know if there is a different option that I have not discovered yet to tell this method to create the file in the modern .xlsx format instead, so each of my users does not need to go change the trust center setting?
The code of interest I am using is as follows:
'Initialize MS Project and open the file
IMSProgressUserForm.Text2.Visible = True
Set ProjApp = New MSProject.Application
ProjApp.FileOpen Name:=IMSFilePath, ReadOnly:=True, IgnoreReadOnlyRecommended:=True, NoAuto:=True
ProjApp.FileSaveAs Name:=IMSExportPath, FormatID:="MSProject.xls8", Map:="I&TExportMap"
IMSProgressUserForm.Text2Complete.Visible = True
DoEvents