|
-
Aug 30th, 2000, 05:35 AM
#1
Thread Starter
Member
Hello!
I want to open a word doc from VB and put some text and save it. Can anybody tell me how this can be achieved?
Thanks,
-
Aug 30th, 2000, 06:20 AM
#2
_______
<?>
'not sure how you want to do it
'here is one way
'you can shell word and then put your stuff in and save on
close
Private Sub Command1_Click()
Shell "C:\Program Files\Microsoft Office\Office\WINWORD.EXE", 1
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 30th, 2000, 10:53 AM
#3
Addicted Member
Here is some code I've saved from previous answers to questions here:
Dim WordApp As Word.Application
Dim WordRange As Word.Range
Dim nCount As Integer: Dim x As Integer
Dim nlRangeStart As Long
'Starting Word
Set WordApp = New Word.Application
WordApp.Application.Visible = True
WordApp.Documents.Add
Set WordRange = WordApp.ActiveDocument.Range
WordRange.Font.Size = 22
WordRange.InsertAfter "1-Name" & vbCrLf
WordRange.InsertAfter "2-Address" & vbCrLf
WordRange.InsertAfter "3-City" & vbCrLf
For x = 1 To 5
WordRange.InsertAfter " " & vbCrLf 'empty line
Next x
WordApp.ActiveDocument.SaveAs ("Path and Filename")
WordApp.Documents.Close (wdDoNotSaveChanges)
WordApp.Quit
Set WordApp = Nothing
-
Aug 30th, 2000, 10:51 PM
#4
Thread Starter
Member
Thanks Guys for your reply
Ganraj
-
Aug 30th, 2000, 11:44 PM
#5
Conquistador
<¿>
does it need to be a word doc?
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
|