ID: Q105684
The information in this article applies to:
Using OLE Automation, you can retrieve settings from Word's dialog boxes. In the client application, you need to create an object variable to hold the dialog settings and then place the settings into the variable.
For example:
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Dim OptionsVar As Object 'defines object variable
Set OptionsVar = WordObj.CurValues.ToolsOptionsView
The second instruction fills the object variable (OptionsVar) with the
settings from the Tools Options View dialog. CurValues is the method
used to return the current dialog box settings. Once the dialog box
settings are stored in the object variable, you can access the
individual settings using the following syntax:
DialogObjectVar.DialogBoxSettingName
The following Visual Basic procedure determines the current setting of
ShowAll in the ToolsOptionsView dialog, and toggles the setting:
Sub Command1_Click ()
Dim WordObj As Object
Dim OptionsVar As Object
Set WordObj = CreateObject("Word.Basic")
Set OptionsVar = WordObj.CurValues.ToolsOptionsView
If OptionsVar.ShowAll = 1 Then
WordObj.ToolsOptionsView ,,,,,,,,,,,,,,, 0
Else
WordObj.ToolsOptionsView ,,,,,,,,,,,,,,, 1
End If
End Sub
NOTE: Visual Basic version 3.0 does not support named parameters, so
you must identify WordBasic arguments by position using commas as
placeholders.
The above Visual Basic procedure has the same functionality as the following WordBasic macro:
Sub MAIN
Dim dlg As ToolsOptionsView
GetCurValues dlg
If dlg.ShowAll = 1 Then
dlg.ShowAll = 0
Else
dlg.ShowAll = 1
End If
ToolsOptionsView dlg
End Sub
For information about how to do this in Word 97, please see the following
article in the Microsoft Knowledge Base:
ARTICLE-ID: Q159547
TITLE : How to Remove Settings from Word Dialog Boxes
KBCategory: kbmacro
KBSubcategory:
Additional query words: 6.0 ole automation word basic word6
6.0a 6.0c 7.0 word95 word7 winword object visual basic curvalues dlg
as dim
Keywords : kbole kbmacro
Version : 6.0 6.0a 6.0c 7.0 7.0a
Platform : WINDOWS
Last Reviewed: February 6, 1998