Microsoft Project宏中的颜色编码任务 [英] Color coding tasks in a Microsoft Project Macro

查看:107
本文介绍了Microsoft Project宏中的颜色编码任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎应该很简单,但是我看到了一些奇怪的行为.我正在尝试根据标志对任务进行颜色编码.它似乎为任务正确着色,但是在处理过程中的某些时候,已着色的初始任务将重置为黑色.发生的任务似乎也很不一致.这是我尝试执行此任务的方式(简化为"barest"形式):

This seems like it should be straight forward, but I'm seeing some strange behavior. I'm attempting to color code my tasks based on a flag. It appears to be correctly coloring the tasks, but at some point in the processing the initial tasks that were colored are getting reset to black. The task that it happens on seems to be fairly inconsistent too. Here's how I'm trying to perform this task (simplified to it's barest form):

Sub ColorTasks()
    Dim t As Task
    For Each t In ActiveProject.Tasks
        SelectRow t.ID, RowRelative:=False
        Font32Ex Color:=2366701
    Next
End Sub

对于较小的数据集,此代码似乎很好用,但该项目包含大约2,000个任务.有什么想法吗?

This code seems to work just fine for smaller data sets, but this project contains around 2,000 tasks. Any ideas?

推荐答案

我知道这是一个老问题,但我希望它对有类似问题的人有用.

I know that this is an old question but I hope it may be useful for someone with similar problem.

错误是您忘记了在十六进制数字前添加"H",因此正确的应该是:

The mistake is that you've forgotten to add 'H' before hexadecimal number, so properly there should be:

Font32Ex CellColor:=&H3A3AD4
etc

这篇关于Microsoft Project宏中的颜色编码任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆