ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to print Word Document (https://www.excelbanter.com/excel-programming/319837-vba-print-word-document.html)

Brad

VBA to print Word Document
 
Hello, I have a Macro that prints Excel Tabs in a certain order. Now I need
to know how I can print a Word Document inside this macro. Here is my macro.

On Error Resume Next
Application.ActivePrinter = "HP C LaserJet 4550N PCL6 on Ne01:"
If Err.Number = 1004 Then
Application.ActivePrinter = "hp c Laserjet 4550N PCL6 on Ne02:"
Err.Clear
End If
Sheets("Letter").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I would need to have the Word Doc Print after the first "Agreement" prints.
How can I do this? Thanks.


Dick Kusleika[_4_]

VBA to print Word Document
 
Brad

You can use the ShellExecute API as described here

http://www.dicks-blog.com/archives/2.../shellexecute/

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

Brad wrote:
Hello, I have a Macro that prints Excel Tabs in a certain order. Now
I need to know how I can print a Word Document inside this macro.
Here is my macro.

On Error Resume Next
Application.ActivePrinter = "HP C LaserJet 4550N PCL6 on Ne01:"
If Err.Number = 1004 Then
Application.ActivePrinter = "hp c Laserjet 4550N PCL6 on Ne02:"
Err.Clear
End If
Sheets("Letter").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Cover").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Agreement").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I would need to have the Word Doc Print after the first "Agreement"
prints. How can I do this? Thanks.





All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com