Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts

    Run-time error 5941 in Word 2010

    As I cannot write VBA code, I recorded a macro to, amongst other things, insert a page number in a footer of a document, using 'Simple Number 3'. This has resulted in VBA code containing:

    Application.Templates( _
    "C:\Users\Dale\AppData\Roaming\Microsoft\Docum ent Building Blocks\1033\14\Built-In Building Blocks.dotx" _
    ).BuildingBlockEntries("Plain Number 3").Insert Where:=Selection.Range, _
    RichText:=True
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

    When I run this macro, it crashes with:

    Run-time error 5941
    The requested member of the collection does not exist.

    I have checked the .dotx file it refers to and it is there and the Building Block 'Simple Number 3' does exist, so the error must be caused by something else.

    In the searching I have done, prior to posting, I have come across a suggestion that:

    In order to minimize Word's startup time, Microsoft programmed it to not load building blocks into memory until the first time you do something that uses them.

    The suggestion is to add after the comment lines at the beginning:

    Application.Templates.LoadBuildingBlocks


    In my case, adding this as suggested does NOT work.

    The code also raises another critical issue.

    This template is on the file server and is intended to be accessed by a number of people on the network. If the path is pointing to a specific user's local C: drive, how would this work for someone else in any event?

    I would be grateful for advice on how to fix the error and how to overcome the user specific path issue.

    Regards
    useful

  2. #2
    Administrator
    Join Date
    Jun 2010
    Location
    Portugal
    Posts
    12,519
    Thanks
    152
    Thanked 1,398 Times in 1,221 Posts
    Double post.
    Rui
    -------
    R4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •