October 21, 2016
Hot Topics:

Beginning Word Programming In VB

  • November 19, 2002
  • By Ronald Garlit
  • Send Email »
  • More Articles »

The code in the project is loaded with comments and is intended to be stepped through in debug mode with the F8 key in Visual Basic. After each step you should click on the title bar of Word or VB6 to give it focus. DO NOT click in the document area of and instances of MS Word. Before we start look closely at the General Declarations Section of the CreateADoc.frm. You will find the variables and a procedure called IsProgramRunningWord( ). The body of the code looks like this:

If objWord Is Nothing Then  '  ***********************************************  '  Create new Word instance if word isn't running  '  ***********************************************  Set objWord = New Word.ApplicationElse  '  ***********************************************  '  Use an existing instance created by our program  '  ***********************************************  Set objWord = GetObject(, "Word.Application")End If    '}-> If objWord Is Nothing Then

Basically if ObjWord has a value of nothing then we create a new instance. If not we use the GetObject( ) procedure in VB to get a handle of an open iinstance of Word. I cant explain here now. But depending on the version of Word (97/2000) and Windows 95, 98, or W2K you can end up with Multiple instances of MS Word. That is another story when the dust settles and the secrets are weeded out.

Page 2 of 6

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel