MS Project中的GanttBarFormat函数VB.NET

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

我在MS Project中有一个自定义的功能区设置,我想使用它来设置甘特图项目的格式。通过单击功能区的按钮控件来运行代码时,将选择该行(如预期的那样),但是任务的甘特图外观不会更改。

我做错了什么?谢谢!

Public Class ThisAddIn
    Private Sub ThisAddIn_Startup() Handles Me.Startup
        ' MAKE THE ACTIVE APPLICATION ACCESSIBLE GLOBALLY ACCESSIBLE 
        ThisApplication = Me.Application
    End Sub
End Class
Public Class Ribbon1
    Private Sub btnBlackDiamond_Click(sender As Object, e As RibbonControlEventArgs) Handles btnBlackDiamond.Click
        ThisApplication.SelectRow()
        ThisApplication.GanttBarFormat(TaskID:=3, StartShape:=PjBarEndShape.pjDiamond, StartType:=PjBarType.pjSolid, StartColor:=PjColor.pjRed)
    End Sub
End Class
vb.net ms-project
1个回答
0
投票

跳过TaskID参数:

Public Class Ribbon1
    Private Sub btnBlackDiamond_Click(sender As Object, e As RibbonControlEventArgs) Handles btnBlackDiamond.Click
        ThisApplication.GanttBarFormat(StartShape:=PjBarEndShape.pjDiamond, StartType:=PjBarType.pjSolid, StartColor:=PjColor.pjRed)
    End Sub
End Class
© www.soinside.com 2019 - 2024. All rights reserved.