Unpublish completed tasks

  • Thread starter åŠæ–°ä¸æ—§
  • Start date
Å

åŠæ–°ä¸æ—§

Hi, there,

I want to create a macro to automate a process for unpublishing all
completed tasks. Can I apply a formular in the marco such as "field [publish]
value=Yes, if field [%completed] <100%" and "field [publish] value=No, if
field [%completed] =100%" ?


Thanks in advance,

JJin
 
R

Ray McCoppin

Try this VBA code:

Sub UnpublishCompleteTasks()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not (t Is Nothing) Then
If t.PercentComplete = 100 Then
t.IsPublished = False
Else
t.IsPublished = True
End If
End If
Next t
End Sub

Hope this helps
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts
Project Server 2007 archive tool
 
Å

åŠæ–°ä¸æ—§

Hi, Ray,
I created a Macro with your script. When I ran this Macro, system prompts
"Run time error '1101', the argument value is not valid".
After entered debug window, the item "t.IsPublished = True" is yellow
highlighted.
Do you have any suggestion?

Thanks in advance,

JJin


Ray McCoppin said:
Try this VBA code:

Sub UnpublishCompleteTasks()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not (t Is Nothing) Then
If t.PercentComplete = 100 Then
t.IsPublished = False
Else
t.IsPublished = True
End If
End If
Next t
End Sub

Hope this helps
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts
Project Server 2007 archive tool

åŠæ–°ä¸æ—§ said:
Hi, there,

I want to create a macro to automate a process for unpublishing all
completed tasks. Can I apply a formular in the marco such as "field [publish]
value=Yes, if field [%completed] <100%" and "field [publish] value=No, if
field [%completed] =100%" ?


Thanks in advance,

JJin
 
R

Ray McCoppin

That version of Project Professional are you running? 2003 or 2007?
The macro works on 2007 in my enviroment.
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts
Project Server 2007 Archival Tool

åŠæ–°ä¸æ—§ said:
Hi, Ray,
I created a Macro with your script. When I ran this Macro, system prompts
"Run time error '1101', the argument value is not valid".
After entered debug window, the item "t.IsPublished = True" is yellow
highlighted.
Do you have any suggestion?

Thanks in advance,

JJin


Ray McCoppin said:
Try this VBA code:

Sub UnpublishCompleteTasks()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not (t Is Nothing) Then
If t.PercentComplete = 100 Then
t.IsPublished = False
Else
t.IsPublished = True
End If
End If
Next t
End Sub

Hope this helps
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts
Project Server 2007 archive tool

åŠæ–°ä¸æ—§ said:
Hi, there,

I want to create a macro to automate a process for unpublishing all
completed tasks. Can I apply a formular in the marco such as "field [publish]
value=Yes, if field [%completed] <100%" and "field [publish] value=No, if
field [%completed] =100%" ?


Thanks in advance,

JJin
 
Å

åŠæ–°ä¸æ—§

Hi, Ray,

I am working on Project Server 2007

Thanks in advance,

JJin


Ray McCoppin said:
That version of Project Professional are you running? 2003 or 2007?
The macro works on 2007 in my enviroment.
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts
Project Server 2007 Archival Tool

åŠæ–°ä¸æ—§ said:
Hi, Ray,
I created a Macro with your script. When I ran this Macro, system prompts
"Run time error '1101', the argument value is not valid".
After entered debug window, the item "t.IsPublished = True" is yellow
highlighted.
Do you have any suggestion?

Thanks in advance,

JJin


Ray McCoppin said:
Try this VBA code:

Sub UnpublishCompleteTasks()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not (t Is Nothing) Then
If t.PercentComplete = 100 Then
t.IsPublished = False
Else
t.IsPublished = True
End If
End If
Next t
End Sub

Hope this helps
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts
Project Server 2007 archive tool

:

Hi, there,

I want to create a macro to automate a process for unpublishing all
completed tasks. Can I apply a formular in the marco such as "field [publish]
value=Yes, if field [%completed] <100%" and "field [publish] value=No, if
field [%completed] =100%" ?


Thanks in advance,

JJin
 

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