User`s guide

274 VEE User’s Guide
6 Creating Reports Easily Using ActiveX Chapter
Set Doc =
App.Documents.
Add();
Adds a Document in MS Word and assigns it to the Object
variable
Doc.
Note: In the Excel example, Excel was started with a blank
worksheet using CreateObject(Excel.Sheet). In this
example, Word is started and the method Add() adds an
empty Document to it. Either application can be created
either way.
Doc.Activate(); Activates the Document above.
Set Wnd =
App.Active
Window;
Takes the document in the active window and assigns it to
the Object variable
Wnd.
Set Sel =
App.Selection;
Puts focus (selection) into the document and assigns this
to the Object variable Sel. This allows you to insert text.
Wnd.View.Type =
3;
Specifies the type of window for displaying the document.
The 3 indicates a normal window size. A 1 would iconize the
window.
Note: The 3 is used here instead of the constant
wdPageView because the constant is missing from the
Office 2000 Type Library.
Sel.TypeText(***
Test Results ***),
Sel.TypeParagrap
h();
Puts the title
*** Test Results *** in the document and
issue a carriage return/line feed.
Set Bmp =
Doc.Shapes.
AddPicture(FileN
ame);
Puts the panel.bmp bitmap into the document and assigns
this call in the Shapes Class to the Object variable Bmp.
Sel.TypeParagrap
h();
Sel.InsertDateTim
e
(M/d/yy h:mm:ss
am/pm, 0);
Puts a time stamp in the document.
Table 2 9 Entries in the Formula Object
Entry Description