WD97: OLE Automation Fails When Using "Word.Basic" Object

Last reviewed: February 11, 1998
Article ID: Q163729
The information in this article applies to:
  • Microsoft Word 97 for Windows

SUMMARY

Visual Basic for Applications includes a WordBasic Automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word versions 6.x and 7.x.

When you use a programming language that cannot call a Visual Basic for Applications or WordBasic instruction using named arguments, for example, Microsoft Visual Basic 3.0, you must identify these arguments by position using commas as placeholders.

To ensure the correct WordBasic command argument positioning when using OLE Automation to interact with Visual Basic for Applications, use the Position.hlp file for Word for Windows version 6.x.

The following file is available for download from the Microsoft Software Library:

 ~ Position.exe (size: 47167 bytes) 
                  This file contains a Help file (POSITION.HLP). This file
                  is for Visual Basic version 3.0 programmers who want to
                  use OLE Automation to access WordBasic in versions of
                  Microsoft Word.

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION

WordBasic statements or functions in Microsoft Word can take named arguments. If your application does not support named arguments, and you send WordBasic commands through OLE Automation, your application must specify all the parameters to a WordBasic function in the proper order. The same call in WordBasic may only require some of the parameters using named arguments, and those parameters could be provided in any order.

For most WordBasic statements, the positioning of the arguments is documented in the WordBasic Help topics or printed reference entries for those statements. However, the arguments for some statements are not listed in proper order, or the arguments are irrelevant or have no effect. These arguments are not documented in WordBasic Help or in the printed reference.

For example, the InsertIndex statement corresponds to the Index tab in the Index and Tables dialog box. The InsertIndex statement takes a number of arguments that have to do with other tabs in the dialog box, such as the Table Of Contents tab. Because these arguments are irrelevant to inserting an index, they are ignored, and are therefore not documented in WordBasic Help or in the printed reference. But, as an OLE Automation programmer, you need to be aware of these arguments so you can correctly specify arguments by position.

NOTE: If your program was written to call WordBasic commands and you are anticipating interacting with the Microsoft Word Visual Basic for Applications language for all future development, it is recommended that you convert your code from WordBasic to the Microsoft Word Visual Basic for Applications commands.

For a listing of these statements and the correct order of the arguments, look to the Position.txt text file. This file is included on the disk included with the Word Developer's Kit (located in the Wrdbasic directory).

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q161547
   TITLE     : How to Use OLE Automation with Word 6.0/7.0

   ARTICLE-ID: Q105534
   TITLE     : OLE: Visual Basic 3.0 Does Not Support Named Arguments

   ARTICLE-ID: Q112733
   TITLE     : FILE: Help File for VB OLE Automation w/ Word for Windows

For information about WordBasic statements and functions, see the "Microsoft Word Developer's Kit" or WordBasic Help in Word version 6.0 or Word for Windows 95.

For more information about converting WordBasic to Visual Basic, from the Visual Basic for Applications Editor, click the Office Assistant, type "WordBasic," click Search, and then click to view "Visual Basic Equivalents for WordBasic Commands."


Additional query words: 97 word8 word97 8.0 8.0 vb vbe vba 6.0 7.0
winword word7 word95 fileprint
Keywords : kbwordvba kbfile kbinterop kbmacro kbole
Version : 97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 11, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.