I don't understand Why t he following function returning "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
In the next class...
dim itoc as word.TableOfContents
dim tcg as TableOfContentsGenerator
set tcg = new TableOfContentsGenerator
Set itoc = tcg.generatsTOC(doc)
When I am 开发者_如何学编程watching itoc, it is NOTHING
.
I don't see to figure out how is it not working?
It was the silliest mistake on planet . I resolved the problem by correcting the SPELLING of : generatsTOC >>>> generatesTOC
精彩评论