Search code examples
vbams-project

MS Project can't change filname bevor save


I have the following question:

It seems that I cannot change the name of a project file before it is saved. The following code does not work. Does anyone have a better idea? I am using Project 2016

DateToday = Format(Now, "YYYY-MM-DD")

Set Test = Application.Projects.Add(False, PTP_Template, False) 
Test.Name = DateToday & " SomeMoreTest"
Test.SaveAs 

I would like to change the file name so that users already have the correct file name in the file save dialog.

Thanks for any suggestion


Solution

  • It seems that I cannot change the name of a project file before it is saved.

    That is correct. The Project Name property is read-only just as it is with Excel, Word, etc.

    The way around this would be to create a macro to save the file for the user. So instead of the user going to File: Save As, they would need to run the macro.