ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing a Word document from an excel macro (https://www.excelbanter.com/excel-programming/312034-printing-word-document-excel-macro.html)

Mike_Shimandle

Printing a Word document from an excel macro
 
I have an Excel spreadsheet that I use to link information to Word documents.
I have created a hyperlink which opens the Word Document and updates the
links, but I was wondering if a macro could be written that would:
1. Open the Doc
2. Update the Links
3. Print the document
4. Save the document
5. Close the document
I would then be able to create a control button that would allow the users
to click on one button to complete the process.

Ron de Bruin

Printing a Word document from an excel macro
 
Hi Mike

Try something like this

Sub test()
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("C:\ron.doc")
WD.ActiveDocument.PrintOut Background:=False
WD.ActiveDocument.Close
WD.Quit
Set WD = Nothing
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Mike_Shimandle" wrote in message
...
I have an Excel spreadsheet that I use to link information to Word documents.
I have created a hyperlink which opens the Word Document and updates the
links, but I was wondering if a macro could be written that would:
1. Open the Doc
2. Update the Links
3. Print the document
4. Save the document
5. Close the document
I would then be able to create a control button that would allow the users
to click on one button to complete the process.





All times are GMT +1. The time now is 11:41 PM.

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