|
|
|
1. Sub RunWord()
| 2. | Dim WordObj As Object | |
| 3. | Set WordObj = CreateObject("Word.Basic") | |
| 4. | WordObj.FileOpen "PWTEST.DOC" | |
| 5. | WordObj.EndOfDocument | |
| 6. | WordObj.Insert Sheets ("Sheet1").Range("A1").Text | |
| 7. | WordObj.FilePrint 0 |
8. End Sub
This VBA subroutine allows Excel to control Word behind the scenes. (Line numbers added for clarification only.)
|
|
|