Hi Bryan,
you didn't write if you want to have it automatically run on save or
manually started by users. I will describe the automatic way. Your users
will need to change their security stetting in ProjProf to allow macros to
run (Tools - Macro - Security ...)
For a first test, I suggest to create one project and put the code in there.
1. Create a project with some tasks, baseline, ... whatever you do normally.
2. Save and publish
3. Start Visual Basic Editor (Alt+F11)
4. Make sure, that you are in VBAProject (YourTestProjectName) - Microsoft
Project Objects - ThisProject (YourTestProjectName) - see object pane on the
left.
5. Paste the following in:
Private Sub Project_BeforeSave(ByVal pj As Project)
Dim T As Task
Dim A As Assignment
On Error Resume Next 'There should not happen a lot when ignoring errors
For Each T In ActiveProject.Tasks
If Not T Is Nothing And T.Summary = False Then
T.MyWorkVariance = T.WorkVariance
For Each A In T.Assignments
A.MyWorkVariance = A.WorkVariance
Next A
End If
Next T
End Sub
Change "MyWorkVariance" to your field name - it must not include any blanks.
Depending on the field type you chose, you may need to add a calculation
like A.MyWorkVariance = A.WorkVariance/60 .
Make changes to your variance and see if everything works as expected.
If you are fine with the result, you can put this code into Enterprise
Global. Replace steps 1-4 with:
1. Make an administrative backup of your Enterprise Global
2. Open Enterprise Global
3. Start Visual Basic Editor (Alt+F11)
4. Make sure, that you are in VBAProject (Checked-out Enterprise Global) -
Microsoft Project Objects - ThisProject (Checked-out Enterprise Global) (see
object pane on the left)
and after pasting your working code, move on with following steps:
6. Save Enterprise Global
7. Close and checkin Enterprise Global.
8. Restart ProjProf to get that macro active.
If something happens you can restore your Enterprise Global.
If you have more questions, let me know.
Good luck!
Barbara
Thanks Barbara. Could you walk me through the steps of including the
macro in my file? The only thing I know about using VBA for macros is
how to open the window (Alt+F11)!