Microsoft KB Archive/80931

{|
 * width="100%"|

Using Windows Calls to Create Dialog Boxes in Word for Windows

 * }

Q80931

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, version 7.0

-

SUMMARY
In Microsoft Word for Windows macros, you can use Microsoft Windows calls to create dialog boxes.

MORE INFORMATION
The following is a sample Word for Windows macro that uses Windows calls to display a sample dialog box:

Word 7.0
Declare Function GetFocus Lib &quot;user32&quot; Alias &quot;GetFocus&quot; As Long Declare Function MessageBox Lib &quot;user32&quot; Alias &quot;MessageBoxA&quot;(hWndParent \ As Long, lpText As String, lpCaption As String, wType As Long) As Long

Sub MAIN hWndParent = GetFocus lpText$ = &quot;Example Text&quot; lpCaption$ = &quot;Example Caption&quot; wType = 0 result = MessageBox(hWndParent, lpText$, lpCaption$, wType) End Sub

Word 6.0, 2.0
Declare Function GetFocus Lib &quot;user&quot; As Integer Declare Function MessageBox Lib &quot;user&quot;(hWndParent As Integer, lpText$, \ lpCaption$, wType As Integer) As Integer Sub MAIN hWndParent = GetFocus lpText$ = &quot;Example Text&quot; lpCaption$ = &quot;Example Caption&quot; wType = 0 result = MessageBox(hWndParent, lpText$, lpCaption$, wType) End Sub For more information on creating dialog boxes using the WordBasic macro language, query on the following in the Microsoft Knowledge Base:

"dialog and box and macro and editor"