1. Home
  2. Computing & Technology
  3. Visual Basic
VBA - Word and Excel Working Together
Part 2: Designing the System
 More of this Feature
• Part 1: Word and Excel Working Together
• Part 3: The Word Document VBA Code
• Part 4: The Word Form
• Part 5: VBA Code Calling the Excel Server
• Part 6: The Final Result
 
 Join the Discussion
Have you created a system using VBA Automation ?
Tell us about it!
 
 Related Resources
• Beginning Visual Basic
• Visual Basic 6
 
 From Other Guides
• About Business Software
 
 Elsewhere on the Web
• An Excel VBA book
From the great publisher, APress

• Updates from Microsoft
(Browse to Office 2000)

 

One of the next things to decide is how the user will interact with Word and Excel in our system. I decided that the Excel workbook would be updated independently and Excel wouldn't be started as an application while editing the Word document. The numbers from the Excel workbook are simply extracted and inserted into the Word document using VBA programming.

Another "user interface" issue is where to place the VBA code and how to present controls to the user. It's quite possible to place the controls (command buttons, listboxes) directly into the Word document rather than adding a Windows form and placing them on a form as we will do in this example. Placing controls directly into a document can work very well for a lot of applications but it just creates difficulties in our system. And, in general, you gain a lot of flexibility by using a form to contain your controls. I'll cover this again when we look at the actual VBA code.

VBA Project

I decided to implement the system by displaying a Windows form along with the Word document when the document is opened. This design decision tells me where at least some of the VBA code will have to be: in the Open event for the Word document. The rest of the VBA code is in the Windows form. Here's the display in the VBA editor of the finished system:

Next page > The Word Document VBA Code > Page 1, 2, 3, 4 5, 6
Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.