Question 1)
Here's the code that I wrote to do this but it's really slow. I can't
determine if it's my computer or if the code is processor-intensive.
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
If t.Summary = False Then
t.Duration = DurationFormat(t.Duration, Units:=pjDays)
End If
End If
Next
Question 2)
How do I get the durations on the Summary Tasks to display in days? I
tried the DurationFormat method above on Summary Tasks but it would
not allow it.
Thanks!
JJ
- Andrew Lavinsky
Blog: http://blogs.catapultsystems.com/epm
The only duration-formatting built-in function that I could find is
the one that I have in the code... DurationFormat(Duration,Units)
Here's the code for it:
'DISCLAIMER OF WARRANTY
'
'THE SAMPLES DESCRIBED IN THIS DOCUMENT ARE UNDOCUMENTED SAMPLE CODE.
'THESE SAMPLES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
'MICROSOFT FURTHER DISCLAIMS ALL IMPLIED WARRANTIES INCLUDING WITHOUT
'LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS
'FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR
'PERFORMANCE OF THE SAMPLES REMAINS WITH YOU.
'
'IN NO EVENT SHALL MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES
'WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
'BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
'OR OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
'THE SAMPLES, EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF
'SUCH DAMAGES. BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR
'LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE
'ABOVE LIMITATION MAY NOT APPLY TO YOU.
' This macro reformats the duration of all the tasks in the project.
' The durations are all expressed in either minutes, hours, days, or weeks.
' The macro also sets the default duration unit. All summary tasks
' and new tasks will be shown in that unit.
Option Explicit
Const MB_NOFILEOPEN = "You do not have a project open. Open a project, and
then run the macro again."
Sub Format_Duration()
Application.OpenUndoTransaction ("Format Duration")
On Error GoTo ErrorHandler
Check_if_Project_Open
frmFormatDuration.InitializeList
frmFormatDuration.cboDurUnit.SetFocus
frmFormatDuration.cboDurUnit.SelStart = 0
frmFormatDuration.cboDurUnit.SelLength = frmFormatDuration.cboDurUnit.TextLength
frmFormatDuration.Show
ExitSub:
Application.CloseUndoTransaction
Exit Sub
ErrorHandler:
ProcessError Err
GoTo ExitSub
End Sub
Private Sub Check_if_Project_Open()
'Procedure checks if a project file is open
On Error GoTo NoFileOpen:
Dim strName As String
strName = ActiveProject.Name
Exit Sub
NoFileOpen:
MsgBox MSG_NO_PROJECT_OPEN, vbExclamation + R_TO_L, Title:=Application.Name
End 'End the macro
End Sub
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
"JJ" <metal...@gmail.com> wrote in message
news:d716749f-2fdc-42fb...@h9g2000yqa.googlegroups.com...
Thanks again!
JJ
On Jan 18, 12:39 pm, "Jan De Messemaeker" <janremovet...@prom-ade.be>
wrote:
> Tools, Macro, Macros
> If you do not see Format duration Macro, Security, set to Low
>
> --
> Jan De Messemaeker
> Microsoft Project Most Valuable Professional
> +32 495 300 620
> For availability check:http://users.online.be/prom-ade/Calendar.pdf"JJ" <metaldog...@gmail.com> wrote in message
Is this normal? Just curious.
- Andrew Lavinsky
Blog: http://blogs.catapultsystems.com/epm
> I just wanted to add that my IMS has 2400+ tasks and it took 38
> minutes to format all the durations to days using the Format_Duration
> macro.
>
> Is this normal? Just curious.
>
> On Jan 18, 2:29 pm, JJ <metaldog...@gmail.com> wrote:
>
>> Thanks Jan and Andrew! I was able to find it after setting the Macro
>> Security to low. I am running it now, but I am noticing that it takes
>> just as long to complete as the code I wrote. It still has not
>> completed; however, I am assuming that it will convert Summary Tasks
>> as well. In any case, it is there.
>>
>> Thanks again!
>> JJ
>> On Jan 18, 12:39 pm, "Jan De Messemaeker" <janremovet...@prom-ade.be>
>> wrote:
>>
>>> Tools, Macro, Macros
>>> If you do not see Format duration Macro, Security, set to Low
>>> --
>>> Jan De Messemaeker
>>> Microsoft Project Most Valuable Professional
>>> +32 495 300 620
>>> For availability
>>> check:http://users.online.be/prom-ade/Calendar.pdf"JJ"
>>> <metaldog...@gmail.com> wrote in message
>>> news:d716749f-2fdc-42fb...@h9g2000yqa.googlegroups.co
>>> m... I do not see a "FormatDuration" macro. I am currently using
Lots of RAM will help here. Note that VBA does have an uncorrected memory
leak that causes iterative operations like this to slow down through the
iterations.
--
Gary L Chefetz, MVP, MCT, MCITP
msProjectExperts http://www.msprojectexperts.com
FAQs and Reference http://www.projectserverexperts.com
BLOG: http://projectserverhelp.com
"JJ" <metal...@gmail.com> wrote in message
news:5a058fd3-a184-4453...@21g2000yqj.googlegroups.com...