devxlogo

Calling on Word

Calling on Word

Microsoft Word exposes the WordBasic object. Through this object, you can execute WordBasic statements. The WordBasic statements and functions can be used as methods of the WordBasic object. Most WordBasic method names match the menu selection available in Word, and the parameters match the dialog items:

 'Declare form levelDim wd As ObjectSub CreateWordObject( )Set wd = CreateObject ("Word.Basic")wd.FileNewDefaultwd.FontSize 20wd.Insert "Hello, World"wd.FileSaveAs "Hello.Doc"wd.FileClose

If you are familiar with Microsoft Word, you know that each method name corresponds to the menu name concatenated by submenu option names, and the functionality is the same as in Word. You can also use the Word Macro recorder to create code and then copy that code to your Visual Basic application.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist