0

VBA を使用して、Microsoft Project 2007 のタスク フィールド Text1 から Text30 のタイトルを変更しようとしています。

これが私が手動で行うことです:

ガント チャート タスク テーブルで、テーブル ヘッダーをクリックし、列を追加します。ポップアップで、追加するタスク プロパティ (私の場合は「Text1」) を選択し、「my text1」などのタイトルを入力できます。

しかし、私はテーブルを気にしません。テキストフィールドにタイトルを付けたい。Text1 から Text30 を XML ファイルにエクスポートし、フィールドのタイトルもエクスポートしたいので、タイトルを取得する必要があり、それを設定するのが好きです。エクスポートされました。

テスト用に書いたものは次のとおりです。

Private Sub setfieldtitletryout()
  Dim i As Integer
  Dim c As Long
  For i = 1 To 30
    c = FieldNameToFieldConstant("Text" & i, pjTask)
    Debug.Print "Text" & i; " has constant " & c
    Debug.Print "  Name of Text" & i; " is " & FieldConstantToFieldName(c) ' well what a surprise...
    SetFieldTitle(c, ListOfNames(i)) ' Oviously doesn't work, because the function doesn't exist :-(
    Debug.Print "  Title of Text" & i; " is " & FieldConstantToFieldTitle(c) ' unfortunately doen't exist too
  Next
End Sub

これが私がチェックしたものですが、私を助ける準備ができていませんでした…</p>

http://msdn.microsoft.com/en-us/library/bb221504(office.12).aspx

http://msdn.microsoft.com/en-us/library/bb221254(office.12).aspx

これを修正していただければ幸いです。

助けてくれてありがとう!

乾杯

B

4

1 に答える 1

2

まあ、私はそれをやった:-)

Private Sub setfieldtitletryout()
  Dim i As Integer
  Dim c As Long
  For i = 1 To 5
    c = FieldNameToFieldConstant("Text" & i, pjTask) ' get constant of custom field by name
    Debug.Print i & ". Rename title of Text" & i
    Debug.Print "   Name of Text" & i; " is '" & FieldConstantToFieldName(c) & "'"

    CustomFieldRename FieldID:=c, NewName:="Titel of Text " & i  'Rename/set custom field title
    Debug.Print "   Title of Text" & i; " is '" & CustomFieldGetName(c) & "'" ' get title of custom field
  Next
End Sub

http://msdn.microsoft.com/en-us/library/ms453877(v=office.12).aspx

CustomFieldRenameのヘルプ

CustomFieldGetNameのヘルプ

于 2011-04-05T19:47:00.960 に答える