|
-
Apr 28th, 2000, 01:26 AM
#1
Thread Starter
Addicted Member
Okay I open the Word doc actually dot that I need. Now I need to with code print text with variables in between; any ideas?
Should I use a bookmark; start at the beginning of the doc and have the code print the info? But how would the code in VB look to do this; any examples would be great!
Thanks
-
Apr 28th, 2000, 01:59 AM
#2
Addicted Member
I think this is what you are looking for:
Dim WordApp As Word.Application
'Starting Word
Set WordApp = New Word.Application
DoEvents
'Open template
WordApp.Documents.Open "Template path and name.dot"
If Err = 0 Then
'Attaching data source
WordApp.ActiveDocument.MailMerge.OpenDataSource "Data path and name"
If Err = 0 Then
'Run the mail merge
WordApp.ActiveDocument.MailMerge.Execute
'Save the document
If Err = 0 Then
WordApp.ActiveDocument.SaveAs "Save path and filename.doc", wdFormatDocument
If Err = 0 Then
'Close all open Word documents and exit Word
WordApp.Documents.Close wdDoNotSaveChanges
WordApp.Application.Quit
Set WordApp = Nothing
-
Apr 28th, 2000, 05:08 AM
#3
Thread Starter
Addicted Member
I dont need to do a word merge, I would just like to insert default text into the document that is stringed to variables from the program. The merge would be slower and more complicated for what I need.
Thanks
-
Apr 28th, 2000, 05:45 AM
#4
Thread Starter
Addicted Member
here is the magical code once i open the active document i do this code to insert variables and text!!!
obj.Selection.TypeText Date ' Insert current date
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
|