PDA

View Full Version : Sleeper: Help with VBA Excel tool to create MS Project Plan



fazz2g
09-21-2015, 09:48 AM
Hi all

I'm trying to make some changes to some VBA someone has created, in a nutshell a spreadsheet creates a project plan in Excel and then with a press of a button it exports this data in Project creating milestones, dates, etc.

It works but it doesn't always work, for instance when creating a project, it breaks when creating the project or when creating the indents/outlines for tasks. But after pressing the button a few times it works. Also I have been trying to add a new button to update an existing project file with just the dates from the spreadsheet instead of creating a new each time the macro is run. I tried to use fileopen to get the path of the file but having real trouble in resolving various errors with 'type mismatch' amongst other things. Alas at least I got the file to open :S.

I am currently running the excel document in 2010 and using Project 2013.

The macro button is found in the 'Gate 2' tab.

Would really like to make some progress and some hints and tips on increasing my knowledge in VBA. Thanks in advance.

fazz2g
09-21-2015, 03:05 PM
So I have made a little progress, using button 2 I am now picking up the data from an existing project file. I now need to overwrite or paste the tasks at index 1 in the project. The data is now pasting below the existing project tasks. The code below is how I got it to read an existing project file, I'm hoping to add a sub-routine to pick-up the path from an fileOpen function at a later stage.


Dim prApp As MSProject.Application
Dim CurrProject As MSProject.Project
Set prApp = New MSProject.Application
prApp.FileOpen "c:\users\me\Project1.mpp"
Set CurrProject = prApp.ActiveProject
With CurrProject.....

fazz2g
09-22-2015, 06:03 AM
So it seems the best way is to link excel data with project data using project.tasks.uniqueid(x) can any one give me some input oh how I can get this to work?

fazz2g
09-22-2015, 08:55 AM
So I have got to update the dates according to the index of the task, using projects.tasks(1).start etc but it stops after 5 dates and the loop counter is at 197