0
使用VBA和與Word文檔工作,我嘗試創建使用集NewStyle不MS Project 2003的工作
Function CreateStyleHeadingTask(NameStyle As String) As Style
Set CreateStyleHeadingTask = Nothing
If Not wdDoc Is Nothing Then
With wdDoc
Set CreateStyleHeadingTask = .Styles.Add(Name:=NameStyle, Type:=wdStyleTypeParagraph)
'//.Styles.Add Name:=NameStyle, Type:=wdStyleTypeParagraph
With .Styles(NameStyle).Font
.Size = 14
.Bold = True
'//.Color = wdColorBlue
.Color = wdColorRed
End With
Set CreateStyleHeadingTask = .Styles(NameStyle)
End With
End If
End Function
這是我執行設置CreateStyleHeadingTask聲明將盡快崩潰了新的風格。 如果我刪除'Set CreateStyleheadingTask =',它不會崩潰。 什麼是錯的,我該如何糾正它?