SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 258 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

It
also allows us to create workflows within the Office suite of applications.
In this chapter, we will see how we can turn an Excel workbook into a summary report in
Microsoft Word. We??™ll also take that same workbook and create a presentation in Microsoft
PowerPoint. Both documents will include text and chart data from our Excel project.
The code we??™ve been writing so far has accessed properties of Microsoft Excel 2007 using
the Excel Document Object Model (DOM). We will now explore some of the common DOM
objects for Word and PowerPoint as we delve into Office automation.
Creating a Report in Word
In Chapter 5, we explored charting in Excel 2007. We are going to turn one of our chart reports
into a summary report using the Word 2007 DOM from the Excel 2007 VBE.
In this example, you??™ll learn how to do the following:
??? Open an instance of Microsoft Word programmatically
??? Create a new document within the instance of Word
??? Add text
??? Apply styles
??? Insert chart objects from Excel
Let??™s start by opening an existing Excel project that contains numeric and chart data.
We??™ll use the charts in our summary report in Word.
1. From the source files for this book, open the file Chapter 8\Files\Chart08.xslm.
The file contains sales data and pie charts for a few product categories that we need to
create a report on. The report will cover the first few months of sales year 2007, as shown in
Figure 8-1.
287
C H A P T E R 8
Figure 8-1. Sales data and pie charts
2.


Pages:
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270