我不明白为什么他跟着函数返回“Nothing”
Public Function generatsTOC(ByRef doc As Word.Document) As Word.TableOfContents
Dim toc As Word.TableOfContents
Set toc = doc.TablesOfContents.Add(range:=doc.range(0, 0), UseHyperlinks:=True, _
UseFields:=False, UseHeadingStyles:=True, _
UpperHeadingLevel:=1, LowerHeadingLevel:=4, IncludePageNumbers:=True, _
RightAlignPageNumbers:=True)
Set generatesTOC = toc
End Function
在下一课......
dim itoc as word.TableOfContents
dim tcg as TableOfContentsGenerator
set tcg = new TableOfContentsGenerator
Set itoc = tcg.generatsTOC(doc)
当我观看itoc时,它是NOTHING
。
我不知道它是如何起作用的?
答案 0 :(得分:0)
这是地球上最愚蠢的错误。我通过纠正SPELLING来解决了这个问题:generatsTOC>>>> generatesTOC