MS Project 2003 - VB Macro

D

Dasani

I would like to apply a macro (at once) across all open projects in MS
Proj 2003. Any advice?

I would also thoughts on the easiest way to transfer excel actual data
into MS Project actual daily view on a resource setting. Any advice
on how to proceed with VB needed?

Thank you
 
J

JackD

Dasani said:
I would like to apply a macro (at once) across all open projects in MS
Proj 2003. Any advice?

Sub allprojects()
For Each Project In Application.Projects
'run subprocedure
Next Project
End Sub
I would also thoughts on the easiest way to transfer excel actual data
into MS Project actual daily view on a resource setting. Any advice
on how to proceed with VB needed?

Actuals can be tricky. You will use timescaled values. I think that some
sort of unique key (assignment UID) or the like would be useful here. If you
can have it in the excel file and the project file then it will make things
easier.

-Jack
 
R

Richard

Dasani said:
I would like to apply a macro (at once) across all open projects in MS
Proj 2003. Any advice?

I would also thoughts on the easiest way to transfer excel actual data
into MS Project actual daily view on a resource setting. Any advice
on how to proceed with VB needed?

Thank you
Dasani, regarding the 2nd question.
A few months ago, with a great deal of frustration I managed to write a
macro that takes Actual Cost Data from a Text File. I imagine that it could
be adapted to take data from an Excel file. The macro uses the TimeScaleData
method and it is still not clear to me exactly how it works. I managed to get
my macro working with a combination of Recording Macros and searching for
help (& sheer luck!).
Further to this, I have just had my original macro updated (by a
professional VBA writer) to get information directly via an SQL request to
our TimeSheet Data Base.
I am new to this forum so someone please let me know the etiquite for
sharing Macors - do I just post it in full here or ....?

Cheers
Richard
 
R

Rod Gill

Hi,

Dim Proj As Project
For Each Proj In Application.Projects
'All code for each project here.
Next Proj

The only safe way to coy actual data from Excel is if the Excel data has the
Task's and Resource's Unique ID. If it doesn't, then you can't guarantee to
get the correct task/resource combo (assignment), especially if some edits a
task name during the week, inserts and deletes tasks or more. There are a
lot of scenarios to handle, EG a new resource doing work not previously
scheduled on a new task for the project.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
R

Richard

Rod Gill said:
The only safe way to copy actual data from Excel is if the Excel data has the
Task's and Resource's Unique ID. If it doesn't, then you can't guarantee to
get the correct task/resource combo (assignment), especially if some edits a
task name during the week, inserts and deletes tasks or more. There are a
lot of scenarios to handle, EG a new resource doing work not previously
scheduled on a new task for the project.

I agree that there are many scenarios to handle and many posibilities for
errors. For me it was worth the programming effort to not enter data manually
that was already collected in our company timesheet program (Track-It).
The method I used was to first set the project status date then search for a
match on WBS codes (Outline Numbers) and record in a file if no match was
found (& msgbox the user). Extract of macro shown below. Once a WBS was found
(ie task) then check if the resource name matched any names already assigned.
If not add the resource using 0% utilisation to not affect costs. For adding
resources the correct resource ID is found by looping through the resource
file until the name matches.
Once task is found and resource found or added, the actual costs for that
period can be inserted using TimeScaleData.
'***********************************************************
' Search the Project file for this WBS
'***********************************************************
WBS_Found = False
Name_Found = False
For Each My_Task In ActiveProject.Tasks
If Not (My_Task Is Nothing) Then
If My_Task.OutlineNumber = Res_WBS Then 'correct WBS found
WBS_Found = True
For Each My_Assn In My_Task.Assignments
If Not (My_Assn Is Nothing) Then
If My_Assn.ResourceName = Res_Name Then ' correct name
found
Name_Found = True
Exit For
End If
End If
Next My_Assn
Exit For
End If
End If
Next My_Task
 
R

Rod Gill

Hi,

WBS field may not contain unique data or it may change when any tasks is
inserted or deleted. The ONLY reliable way is to use unique ID's. WBS will
very soon provide incorrect reference data.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
R

Richard

Rod Gill said:
Hi,

WBS field may not contain unique data or it may change when any tasks is
inserted or deleted. The ONLY reliable way is to use unique ID's. WBS will
very soon provide incorrect reference data.

Quite correct. I forgot to mention that we freeze first and second level WBS
codes and only book time against these. Hence it works here, but may not work
elsewhere.
Sorry for the confusion.
Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top