M
MarshallR
Hi, I mailed Mike Glen with some VBA questions, and he
advised that Jack was the man to speak to. Here are bits
from my original mail:
I've been playing with VBA to automate tasks quite a bit,
but being completely self-taught (I'm relying solely on
the help files provided!) other than a teeny bit of
experience dabbling in BASIC when I was a kid, it's been
fairly slow going.
However, I've managed to make some very useful code
including one template which creates an mpp for an entire
3 month maintenance release for the software company I
work for - based on an exported Crystal report of the
errors recorded in our database. It used to take a day or
so to key in all the error numbers, descriptions, time
estimates for development, testing etc. Now all it takes
is an export of the rpt file into excel, and copying the
data to clipboard at the right time, as prompted by the
VBA - all in all it can be done in under 5 minutes. This
code is of fairly limited use obviously, given that it's
organisation-specific.
One of the other macros I've written was one I did to
provide a feature which I was surprised isn't offered by
Project as standard - a flag per task which flags when all
the task's predecessors are complete. It loops though
each task and identifies whether the task's immediate
predecessors, and 'grandparents', 'great-grandparents'
etc, are complete. With a graphical indicator on the
customised flag column it provides a very useful tool
(especially for large projects with thousands of lines,
which I've had to deal with - and without collaboration
options!!), which can then be filtered to give a quick
view of what's ready to start.
One thing I still have problems with is how Project treats
inserted mpps in a consolidated project. I've had a lot
of difficulty writing VBA that will effectively manipulate
tasks in a master project, because of things like the
Methods on the whole tending to rely on IDs rather than
Unique IDs. Most of the critical stuff I do (like
the "flag ready to start" macro above) I have decided to
write to be executed on individual sub plans - in fact the
whole macro is encased in a loop which goes through all
the open projects so that I don't have to open each one
individually, run it, close it, open the next one... (i.e.
it runs the process on the first open project, then the
second, and so on).
The one macro I have written which steps through each task
in a consolidated project is one which marks overbudget
tasks of a set tolerance, in red text (one of my managers
wanted an easy view). This was one of the first I wrote
and is very clumsy and slow - rather than using something
like 'for each task...', I resorted to physically forcing
the focus down one cell at a time. It works, but it's
very inelegant! From memory I also had problems
with 'object required' errors on blank lines - had to add
some error handling which again made me a little
disappointed in the way it was constructed.
Do you have any tips for how best to handle consolidated
projects with VBA?
I've also had some problems adding an application object
for Project to handle application events including crashes
in certain circumstances. Is this well known as an area
of instability?
Sorry to have rambled... any help would be appreciated.
Cheers,
Marshall.
advised that Jack was the man to speak to. Here are bits
from my original mail:
I've been playing with VBA to automate tasks quite a bit,
but being completely self-taught (I'm relying solely on
the help files provided!) other than a teeny bit of
experience dabbling in BASIC when I was a kid, it's been
fairly slow going.
However, I've managed to make some very useful code
including one template which creates an mpp for an entire
3 month maintenance release for the software company I
work for - based on an exported Crystal report of the
errors recorded in our database. It used to take a day or
so to key in all the error numbers, descriptions, time
estimates for development, testing etc. Now all it takes
is an export of the rpt file into excel, and copying the
data to clipboard at the right time, as prompted by the
VBA - all in all it can be done in under 5 minutes. This
code is of fairly limited use obviously, given that it's
organisation-specific.
One of the other macros I've written was one I did to
provide a feature which I was surprised isn't offered by
Project as standard - a flag per task which flags when all
the task's predecessors are complete. It loops though
each task and identifies whether the task's immediate
predecessors, and 'grandparents', 'great-grandparents'
etc, are complete. With a graphical indicator on the
customised flag column it provides a very useful tool
(especially for large projects with thousands of lines,
which I've had to deal with - and without collaboration
options!!), which can then be filtered to give a quick
view of what's ready to start.
One thing I still have problems with is how Project treats
inserted mpps in a consolidated project. I've had a lot
of difficulty writing VBA that will effectively manipulate
tasks in a master project, because of things like the
Methods on the whole tending to rely on IDs rather than
Unique IDs. Most of the critical stuff I do (like
the "flag ready to start" macro above) I have decided to
write to be executed on individual sub plans - in fact the
whole macro is encased in a loop which goes through all
the open projects so that I don't have to open each one
individually, run it, close it, open the next one... (i.e.
it runs the process on the first open project, then the
second, and so on).
The one macro I have written which steps through each task
in a consolidated project is one which marks overbudget
tasks of a set tolerance, in red text (one of my managers
wanted an easy view). This was one of the first I wrote
and is very clumsy and slow - rather than using something
like 'for each task...', I resorted to physically forcing
the focus down one cell at a time. It works, but it's
very inelegant! From memory I also had problems
with 'object required' errors on blank lines - had to add
some error handling which again made me a little
disappointed in the way it was constructed.
Do you have any tips for how best to handle consolidated
projects with VBA?
I've also had some problems adding an application object
for Project to handle application events including crashes
in certain circumstances. Is this well known as an area
of instability?
Sorry to have rambled... any help would be appreciated.
Cheers,
Marshall.