Ms Word XP printing

M

Miki Peric

Is this code OK:

Sub OpenAndPrintWordDoc(strFile As String)
' assumes that the previous procedure has been executed
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim tString As String, tRange As Word.Range
Dim p As Long, r As Long

Set wrdApp = CreateObject("Word.Application")
'wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open(strFile)
' example word operations
wrdDoc.Print
wrdApp.Quit ' close the Word application

Set wrdDoc = Nothing
Set wrdApp = Nothing

End Sub

It doesn't print document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top