L
Leila
Hi There,
In some of our PCs for the below code on line:
Set rngLocation =
tplAttached.AutoTextEntries(strAutoTextName).Insert(rngLocation, True)
I get this error:
"Runtime error 5941: the request number of collection does not exist"
Would you please let me know what I'm missing here? is there any
reference(lib) for this error that I might left out?
Thanks so much for your help
---------
Private Sub InsertAutoText(ByVal strAutoTextName As String, _
ByVal strBookmarkName As String)
'This code inserts the AutoText containing the TOC field at the location of
the
'old TOC.
Dim tplAttached As Word.Template
Dim rngLocation As Word.Range
' Insert specified autotext at the bookmarked location
' and then recreate the bookmark
Set tplAttached = ActiveDocument.AttachedTemplate
Set rngLocation = ActiveDocument.Bookmarks(strBookmarkName).Range
Set rngLocation =
tplAttached.AutoTextEntries(strAutoTextName).Insert(rngLocation, True)
ActiveDocument.Bookmarks.Add strBookmarkName, rngLocation
End Sub
In some of our PCs for the below code on line:
Set rngLocation =
tplAttached.AutoTextEntries(strAutoTextName).Insert(rngLocation, True)
I get this error:
"Runtime error 5941: the request number of collection does not exist"
Would you please let me know what I'm missing here? is there any
reference(lib) for this error that I might left out?
Thanks so much for your help
---------
Private Sub InsertAutoText(ByVal strAutoTextName As String, _
ByVal strBookmarkName As String)
'This code inserts the AutoText containing the TOC field at the location of
the
'old TOC.
Dim tplAttached As Word.Template
Dim rngLocation As Word.Range
' Insert specified autotext at the bookmarked location
' and then recreate the bookmark
Set tplAttached = ActiveDocument.AttachedTemplate
Set rngLocation = ActiveDocument.Bookmarks(strBookmarkName).Range
Set rngLocation =
tplAttached.AutoTextEntries(strAutoTextName).Insert(rngLocation, True)
ActiveDocument.Bookmarks.Add strBookmarkName, rngLocation
End Sub