在我的文档中,我将 Format Page Numbers / Start at: 设置为 0,以便不计算标题页。
当我通过 VBA 执行 SaveAs 时,文档会丢失该设置!它也丢失了“不同的首页”设置,所以我直接在 VBA 中进行了设置,从而解决了这个问题。我认为,因为我在执行 SaveAs 之前通过 VBA 格式化页脚,所以我会以某种方式影响设置?无论如何,我尝试在 SaveAs 之后设置 Start At 页码,但它没有设置它。
' Save our new Workbook - the output file
' That makes the new file the ActiveDocument
ActiveDocument.SaveAs filename:=fname & ".docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
' Sets this option correctly
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
' Problem: Doesnt set this option
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers.StartingNumber = 0
' Update the TOC
ActiveDocument.TablesOfContents(1).Update
有任何想法吗?
谢谢,默里