Search code examples
excelvbams-project

Apply MS Project SetTaskMode via Excel VBA


I am reading a sheet in Excel and creating a Microsoft Project Plan of tasks, Work, Notes, etc.

The code is being executed out of MS Excel.

How can I get the Active.Project to assign, SetTaskMode Manual:= False?

I receive an error, please note Application.Visible = True.

As far as .Application.Methods (Project) go, I am able to invoke the Application.About screen, i.e on Sub execution the MS Project About screen opens up, however after that line, it stops.

Basically, I would like to set the Active Sheet Task Mode to be set to 'automatically scheduled' as the default for all tasks as they are being imported.


Solution

  • The project property in question is NewTasksCreatedAsManual and is used like this to make all new tasks auto-scheduled:

    ActiveProject.NewTasksCreatedAsManual = False
    

    Alternatively, to set the task mode to auto-schedule on an individual task, use the Manual property like this:

    tsk.Manual = False
        
    ' or to change to manually scheduled
    tsk.Manual = True