Excel 到 Ms Project VBA - 插入任务、设置字体、下划线和斜体

发布于 2025-01-19 14:03:56 字数 514 浏览 3 评论 0原文

我在 VBA (Excel) 中有以下代码行,成功在 MS Project 中生成任务,并建立了正确的大纲级别。但是,我想将特定任务的“名称字段”的格式设置为带有下划线和或斜体:

示例代码:

ActiveProject.Tasks.Add ("Enter Task Name #1")
ActiveProject.Tasks ("Enter Task Name #1").OutlineLevel = 1
ActiveProject.Tasks.Add ("Enter Task Name #2")
ActiveProject.Tasks ("Enter Task Name #2").OutlineLevel = 2
ActiveProject.Tasks.Add ("Enter Task Name #3")
ActiveProject.Tasks ("Enter Task Name #3").OutlineLevel = 3

如何为正在导入的任务设置格式选项或者选择导入的任务并设置所需的格式?

I have the following lines of code in VBA (Excel), successfully generating tasks in MS Project, with the correct outline level established. However, I would like to set the formatting of the 'Name field' of a specific task to be have an underline AND OR be italicized:

Sample Code:

ActiveProject.Tasks.Add ("Enter Task Name #1")
ActiveProject.Tasks ("Enter Task Name #1").OutlineLevel = 1
ActiveProject.Tasks.Add ("Enter Task Name #2")
ActiveProject.Tasks ("Enter Task Name #2").OutlineLevel = 2
ActiveProject.Tasks.Add ("Enter Task Name #3")
ActiveProject.Tasks ("Enter Task Name #3").OutlineLevel = 3

How would I go about setting formatting options to a task that is being imported or selecting the imported task and setting the required formatting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

但可醉心 2025-01-26 14:03:56

输入任务后,使用 >选择任务和应用格式的方法,例如 Fontbold 。例如:

Application.Find "Name", "equals", "Enter Task Name #2"
Application.FontBold
Application.FontItalic

或者,请使用 fontex 可以一次使用多种格式。

Once the tasks are entered, use the Find method to select the task and the apply formatting such as FontBold. For example:

Application.Find "Name", "equals", "Enter Task Name #2"
Application.FontBold
Application.FontItalic

Alternatively, use FontEx which can be used to apply multiple formats at once.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文