SOLVED

MS Project VBA Default Location and Default AutoScheduled tasks

Brass Contributor

Hello,

I have two VBA related questions for MS Project.

 

1) How do I find the Default File Location?

In Excel it is easy with Application.DefaultFilePath but I can't seem to find an equivalent in MS Project.

 

2) How can I set the default Task Mode to Auto Scheduled for all new projects?

I know how to do it in the manually in the options but I'm looking for a VBA approach.

 

Thank You

7 Replies

@Gilgamesh1964 

The default file path for save operations is controlled by the Project options setting. Unfortunately those settings are not readable directly as they are in Excel. I haven't tried this but it may be possible to get the default file path by creating and querying a FileSystemObject.

 

Another option is an indirect method and that is simply opening a file you know is in the default location and then using: ActiveProject.FullName

 

On your other question, for whatever reason the scheduling mode is not an exposed parameter when setting options using VBA. Sorry.

 

Hope this helps.
John

Thank you for a quick response.
I will have a play around with FileSystemObject and see what I can get there.

On Auto Scheduling, It seems strange to me that something (in my opinion) is so important is not available.
Do you know if this is stored in a Registry Key, I may try making adjustments there?

The reason for the questions is that our IT department just installs an out-of-the-box version of MS Project, but our Project Office has some standards. I'm trying to automate setting those standards rather than relying on people who can make mistakes.
best response confirmed by Dale_HowardMVP (MVP)
Solution

@Gilgamesh1964,

It is a little strange about the auto/manual scheduling option not being available via VBA, all the other scheduling options are.

 

Yes, you can set auto/manual in the registry. This is what it looks like on my PC, which is currently set for auto schedule.

2021-11-15_18-58-26.png

John

Thank You for all your assistance.
I ran some code to edit the registry key which worked (I opened RegEdit to have a look t it) but when I closed MS Project it reverted to it's previous value 😞

Looks like I will have to write some idiot-proof instructions for people to change this setting manually (and I'm sure someone will still mess it up)
Gilgamesh1964,
You're welcome and thanks for the feedback.

Strange. I've never tried to change the registry with code, I've only done it manually. Did you include in your code a line to save Project? I would think that would save the change to the GLobal.
John

@John-project 

Hi
Sorry for taking so long to get back (non schedule based project work got in the way :smile:).

No I hadn't added a line to save the project. I would have thought as I'm changing the default for new schedules then a save of the current one would not be necessary.

However I added one, and this is where we now enter the Twilight Zone.

New schedules were being created with Auto Scheduled tasks as desired. But when looking at the MS Project settings it was still showing Manual Scheduled as the default setting for new schedules ????

Changing this MS Project setting in the standard GUI interface no longer had any effect, I would set it for Auto Scheduled, Leave, and upon going back in it said Manually Scheduled again. Yet new schedules continued to be created as Auto Scheduled.

I managed to restore normal functionality by using RegEdit to restore the setting, and I think I'll stick with manual instructions to get this setting as desired.

Yeah I remember that episode, I think it was 1963. Oh well, you do what you have to do to make it all work 🙂
Thanks for the feedback.
john
1 best response

Accepted Solutions
best response confirmed by Dale_HowardMVP (MVP)
Solution

@Gilgamesh1964,

It is a little strange about the auto/manual scheduling option not being available via VBA, all the other scheduling options are.

 

Yes, you can set auto/manual in the registry. This is what it looks like on my PC, which is currently set for auto schedule.

2021-11-15_18-58-26.png

John

View solution in original post