|
-
Dec 2nd, 2001, 05:30 PM
#1
Thread Starter
Hyperactive Member
MS Word
Once one has referenced the Word 9.0 Library in VB.
How Can I create a new document (blank to start with)
and how can I "write" to it without having word open.
I can do this in excel but i cant seem to find any "New" function in the Word library ...
Some sample code would be of great help.
- Thanks.
-
Dec 2nd, 2001, 05:47 PM
#2
Hyperactive Member
As with all Office Apps, the easiest way to automate them is to record a Macro in the App, and copy the VB code generated into your project, with minor modifications
VB Code:
Dim MyWord As New Word.Application
MyWord.Visible = False
MyWord.Documents.Add
MyWord.Activate
MyWord.Selection.InsertAfter "New Text Here"
Remeber if you keep it with .Visible =False, to quit with
MyWord.Quit wdDoNotSaveChanges
This will prevent an invisible dialog box coming up asking if you want to save changes. (Except of course you can't see it...)
Last edited by gab2001uk; Dec 2nd, 2001 at 05:52 PM.
Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
www.gab2001uk.com For comparing and contrasting DAO with ADO
Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek
-
Dec 3rd, 2001, 06:54 AM
#3
Thread Starter
Hyperactive Member
Thanks that helped.
I have another question Though.
How can I Save the content of a word file (with aall the formating)
into aa database for example. to be able to restore it later .
I am not sure this is doable. but it would help a lot.
thanks again.
-
Dec 3rd, 2001, 06:58 AM
#4
-= B u g S l a y e r =-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|