Microsoft Office Tutorials and References
In Depth Information
Changing Custom Dictionaries On-the-Fly
Follow these steps:
1. Copy the code to a template. Use the Organizer to copy the "Custom
dictionaries" toolbar from the sample document to the template.
2. Without the sample document, use the code at the end of this section to
generate the toolbar. Copy it into the same template and run it once.
3. The macro works best when run from a template in the Startup folder.
Save the template to the Word Startup folder. The next time Word is
started, it will be loaded in the background as a global template and the
'AutoExec' macro will run, displaying the toolbar.
Wrd
Tip: To find the location of the Word Startup folder, look in Tools | Options | File locations.
Tip: The 'CreateCustomDicToolbar' macro code can be run from the Visual Basic Editor to create
the toolbar initially.
View the Appendix to learn how to store this procedure
in a Standard module.
Sub CreateCustomDicToolbar()¶
'Variable declaration¶
Dim cb As Office.CommandBar¶
Dim cbo As Office.CommandBarComboBox¶
Dim btn As Office.CommandBarButton¶
Application.CustomizationContext = ThisDocument¶
Set cb = Application.CommandBars.Add(Name:="Custom dictionaries 2")¶
With cb¶
Set cbo = .Controls.Add(Type:=msoControlComboBox)¶
With cbo¶
.Caption = "Add words to this dictionary"¶
.OnAction = "ActivateDic"¶
.Style = msoComboLabel¶
.Width = 400¶
End With¶
Set btn = .Controls.Add(Type:=msoControlButton)¶
With btn¶
.Caption = "Update list"¶
.OnAction = "FillDicList"¶
.Style = msoButtonIcon¶
End With¶
End With¶
cb.Visible = True¶
End Sub¶
Search JabSto ::




Custom Search