-
Hi,
can anyone let me know how to print a string using the word application object model.
I think it should be simple but don't know the correct objects to use. Put simply I have a string which I want to print from VB, via MS word without showing the word application.
Thanks in advance.
Lenin
-
First of all, add a reference to you project for the Microsoft Word 8.0 Object library. Then this will work:
Dim WordApp As Word.Application
'Starting Word
Set WordApp = New Word.Application
WordApp.Application.Visible = False
WordApp.Documents.Add
WordApp.ActiveDocument.Words(1).InsertAfter "New text "
WordApp.ActiveDocument.PrintOut Background:= False
WordApp.Documents.Close wdDoNotSaveChanges
WordApp.Application.Quit
Set WordApp = Nothing
-
HDR,
many thanks, that is exactly what I required.
Lenin