Blog - Robert Bogue [MVP]
Rob's Notebook
Categories
Articles
Personal
Professional
Links
Photos
Archive
Archive (Calendar)
Blogs that link here (Technorati)
Bluelock - Infrastructure as a Service!
Cocktail Sax - Indianapolis Jazz Band
OPML File Blogs I Read
The SharePoint Shepherd's Guide for End Users
Microsoft MVP Profile
Archives
June 2005 (12)
July 2005 (16)
August 2005 (23)
September 2005 (12)
October 2005 (17)
November 2005 (22)
December 2005 (2)
January 2006 (17)
February 2006 (20)
March 2006 (6)
April 2006 (7)
May 2006 (10)
June 2006 (6)
July 2006 (2)
August 2006 (7)
September 2006 (9)
October 2006 (5)
November 2006 (12)
December 2006 (14)
January 2007 (9)
February 2007 (6)
March 2007 (5)
April 2007 (2)
May 2007 (5)
June 2007 (6)
July 2007 (7)
August 2007 (7)
September 2007 (5)
October 2007 (7)
November 2007 (7)
December 2007 (2)
January 2008 (10)
February 2008 (2)
March 2008 (4)
April 2008 (8)
May 2008 (6)
June 2008 (14)
July 2008 (7)
August 2008 (12)
September 2008 (1)
Other Blogs
RSS
Thor Projects LLC - Welcome
Article: Office Space - From VBA Macro to Word Add-In
Posted by Robert L. Bogue on Monday, 19 May 2008 02:21 | 0 Comments |
Document automation isn't a new functionality by any means. It has been going on since the invention of macros, and there has been a full-fledged programming model within Microsoft® Office applications since the early 1990s. For many years, the Office tools have featured macro recorders that weren't limited to simply replaying keystrokes but have been capable of writing code on the fly as well. Macros have even demonstrated that they are functional enough to write viruses. And while writing a virus using a Word macro may be a dubious feat, it is a feat nonetheless.
However, even with all of the capabilities of Visual Basic® for Applications (VBA), there are some things it just doesn't do very well. In the early days of VBA, XML hadn't yet been invented, the Internet was in its infancy, and the first HTML pages were just beginning to appear. As such, it's no wonder that making a Web service call isn't well handled in the context of Visual Basic for Applications.
The Microsoft .NET Framework CLR, on the other hand, understands these technologies quite well. The ability to call Web services is just one among a number of reasons for wanting to write .NET-targeted code rather than VBA—and doing so means using Visual Studio® Tools for Office (VSTO). But switching from VBA to VSTO doesn't have to be a case of throwing the baby out with the bath water; rather, it can be just a natural way to extend how you are already developing solutions in Office.
In this column you'll see how to use Word to capture some VBA code that solves a basic problem. Then I will use the latest version of VSTO included with Visual Studio 2008 to wrap this code into a deployable Word add-in. I'll also write some simple code for some of the tasks that the macro recorder either just can't record or doesn't record in an optimal way.
http://msdn.microsoft.com/en-us/magazine/cc507643.aspx
Comments
Leave your own comment
Name
Url
Email
Comments