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:UsersDaleAppDataRoamingMicrosoftDocum ent Building Blocks103314Built-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