Output Strategies

You've already seen a few examples of simple, unstructured output. I'd define simple, unstructured output as output that uses the Value property of the Range object to a known worksheet without any regard for formatting and little regard for precise data placement.

For example, Listing 8.2 displayed a simple grid of data to a block of cells on a worksheet. Likewise, Listing 8.4 displayed the names in a given workbook as a simple list. Both of these examples had some output to display, and displayed it by dumping it in a range of contingent worksheet cells.

Figure 8.12

A raw, unformatted report in need of some help

E2 Microsoft Office EkccI 2003 Beta - Chapter B EKarnples.xls

Ffe lit View Insert Fgrmet Idols &ote Wndow Het> "vpe a question for help -

I S . 11111% - g j 10 - |T| / I! I B m I % ' j8 i" ip ^J ' ^ ' A *_

Ffe lit View Insert Fgrmet Idols &ote Wndow Het> "vpe a question for help -

I S . 11111% - g j 10 - |T| / I! I B m I % ' j8 i" ip ^J ' ^ ' A *_

A i

B

c

0

E

F

G

H

1

J

K

IS

M

n

1

Occupancy Expense

Detail

2

37SG5

3

t

5

Ë

Jan

Fob

Mar

Apr

May

J un

Jul

Auq

Sep

Oct

Nov

Dec

Total

7

Rent & Lease

1000

100

100

100

too

100

100

100

100

100

100

100

a

Cleaning

10UU

100

100

100

i00

100

100

100

100

100

100

100

0

R&M/ Contra

100

100

100

100

too

100

100

100

100

100

100

100

lu

Utilities

1UU

100

100

100

too

100

100

100

100

100

10D

100

11

Other Occup;

100

100

100

1CO

100

100

100

100

100

1G0

100

100

12

Taxes

100

100

100

100

too

100

100

100

100

100

100

100

13

Depreciation

100

100

100

100

too

100

1D0

100

100

100

100

100

14

Furniture and

100

100

100

100

too

100

100

100

100

too

10D

100

15

Gain/Loss on

100

100

100

100

too

100

100

100

100

1C0

100

100

16

Total

—1

17

in

H «

► ►!/ Report

fernes

}jest Report/ Tsst Report Modtied /

Test Report origine | <

Rfrsdy

In contrast to simple output, structured output is output to one or more worksheets that are rigidly structured, such as a report template. Structured output is more difficult in the sense that you need to be much more careful regarding the assumptions you make about where the output should go if one of your goals is a robust solution. Consider the raw, unformatted report shown in Figure 8.12. How might you go about formatting this report programmatically?

Earlier in this section, I cautioned against creating rigid, difficult to maintain procedures. Let's take a look at an example of a rigid procedure (see Listing 8.10).

0 0

Post a comment