From Word 2000 VBA help:
Context Property: Returns or sets a string that determines where a command bar will be saved. The string is defined and interpreted by the application. Read/write String. Remarks: You can set the Context property only for custom command bars. This property will fail if the application doesn't recognize the context string, or if the application doesn't support changing context strings programmatically.
Code: Select all
With cbResult
.Name = strIdentifier
.Visible = True
.Position = msoBarTop
Dim strContext As String
strContext = .Context
.Context = strContext ' cannot set the context to its current value
.Context = ThisDocument.FullName ' cannot set the context to a new value
End With
That the statement ".Context = strContext" fails astounds me - if you can't set the context to its existing value, what hope have I?
The recorded macro (document attached) is from this end-user choosing Format, Styles, Oragnizer, Toolbars, and moving the toolbar from Normal.dot to the document file.