|
-
Jul 31st, 2002, 07:04 AM
#1
Thread Starter
Fanatic Member
Word Object
Take a look at this code. (it is a test). From my app i created a word object because i need to get the pages the user want to print from word. I think i am missing something because i cannot get a variable to know the pages to be printed i just found the FROM a TO, the wdprintcurrentpage,etc. Maybe i am missing something.
Dim WithEvents xlApp As Word.Application
Private Sub Form_Load()
Set xlApp = CreateObject("Word.Application")
xlApp.Visible = True
If xlApp.Documents.Count >= 1 Then
MsgBox ActiveDocument.Name
xlApp.ActiveDocument.PrintOut Range:=wdPrintCurrentPage
xlApp.ActiveDocument.ActiveWindow.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="3"
Else
MsgBox "Error..."
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
xlApp.Quit
Set xlApp = Nothing
End Sub
Private Sub XlApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Resp = MsgBox("Have you checked the " _
& "Printer?", vbYesNo)
If Resp = vbNo Then Cancel = True
End Sub
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
|