基于文本输入的汇总摘要任务

问题描述 投票:0回答:1

我正在尝试设置一个快速汇总宏。我有一个很大的项目文件2000行,其中包含重复的摘要任务,称为合同授予日期,这是主要摘要标题之一。但是,不需要经常查看请参见下面的示例项目文件。

enter image description here

我已尝试通过提示摘要任务名称来汇总和在下面的代码来汇总摘要任务,但它返回不匹配错误

   'Roll up Summary Tasks based on Input'

Sub RollUpTasks()

    Dim txt As String
    txt = InputBox("Flag tasks that include the following text in their names:")

    Dim tsk As Task
    Set Proj = ActiveProject

    For Each tsk In Proj.Tasks
    'If task is summary and matchs input txt, set its rollup property to True'
    If tsk.Summary And tsk.Name = InStr(1, tsk.Name, txt, 1) Then
    tsk.Rollup = True
    ' If task isn't a summary task set its Rollup property to False'
    Else
    tsk.Rollup = False
    End If
    Next tsk

End Sub

enter image description here

似乎是我设置的此If语句存在问题enter image description here

vba ms-project
1个回答
0
投票

[我敢肯定地说这个宏只会在甘特上汇总任务。任何人都可以将此扩展到工作表大纲级别吗?

© www.soinside.com 2019 - 2024. All rights reserved.