Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Run time error  5941

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leila - 16 Nov 2004 18:26 GMT
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
Joost Verdaasdonk - 16 Nov 2004 19:14 GMT
Hi Leila,

The error suggests that the autotext entry does not
exists. (in autotext collection)
So you're probarbly calling an autotext name that doesn't
exists..

Try to insert THAT autotext fragment manualy? (use same
name as the macro does)

Hope this helps,
Groetjes,
Joost Verdaasdonk

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.