通过 Excel 使用 VBA 在 MS Project 中的特定位置添加任务
我有包含所有当前任务的 Excel 文件。新任务可以添加到任何位置。我想通过添加缺少的任务来从 Excel 更新我的 MS Project 文件。使用 .Tasks.Add("name from Excel")
将作为 MS Project 底部的新任务。如何使用 Excel 中的 VBA 在中间的特定位置添加新任务?我可以在 Excel 的 VBA 代码中使用 SelectRow
和 InsertTask
吗?
*编辑 忘了提及,.Tasks.Add
不允许我使用第二个参数,就像文档中所说的那样。
With mpp
.Tasks.Add ("name from Excel", RowNumber)
End With
此代码会将 .Tasks.Add ("name from Excel", RowNumber)
行显示为红色。如果我删除第二个参数,那就很好并且可以工作。
I have and Excel file with all current tasks. New tasks maybe be added at any position. I want to update my MS Project file from Excel by adding missing tasks. Using .Tasks.Add("name from Excel")
will as a new Task in MS Project at the bottom. How can i add new Task at a specific location in the middle using VBA from Excel? Can I use SelectRow
and InsertTask
in VBA code from Excel somehow?
*EDIT
Forgot to mention, .Tasks.Add
does not let me use a 2nd argument, like it says in documentation.
With mpp
.Tasks.Add ("name from Excel", RowNumber)
End With
This code will have the line with .Tasks.Add ("name from Excel", RowNumber)
in red. If i remove the 2nd argument, it's fine and works.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速查看文档 Tasks.Add 显示该方法采用可选的第二个参数Before:
利用第二个参数并传入应在其之前添加新任务的任务 ID。例如:
或者
A quick check of the docs for Tasks.Add shows that the method takes an optional second argument Before:
Utilize the second argument and pass in the ID of the task before which the new task should be added. For example:
Or