2
我所有的數據都是在Excel中準備的,最後一步是將數據傳輸到MS Project。在數據傳輸之前,我試圖編輯資源表中的表格列。 (刪除前3默認列,自定義文本1,並在資源表中添加文本1到位置1)Excel VBA - 配置MS Project資源清單
- 下面的代碼在Excel準備 -
Dim Proj As MSProject.Application
Dim NewProj As MSProject.Project
Set Proj = New MSProject.Application
Set NewProj = ActiveProject
'Activate Resource Sheet
Proj.ViewApply Name:="Resource Sheet", SinglePane:=True
'Custom Resource Text1 to From
Proj.CustomFieldRename FieldID:=pjCustomResourceText1, NewName:="From"
'Delete First 3 Default Column
Proj.ColumnDelete
Proj.ColumnDelete
Proj.ColumnDelete
'-----------------------------------------------------------------------
'THIS CODE NEED HELP - It didn't add column to Resource Sheet,
' but add in Gantt Chart Sheet
Proj.TableEdit _
Name:="Entry", TaskTable:=True, NewFieldName:="Text1", _
Title:="From", Width:=6, Align:=1, _
ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, _
RowHeight:=1, ColumnPosition:=1, AlignTitle:=pjCenter
Proj.TableApply Name:="Entry"
我不知道是什麼回事/錯誤編碼,你有沒有看到任何錯誤。