Click here to Skip to main content
15,610,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every body i want to add Two button in Word document first button for printing document and close document ,second button for just closing document , i make new word document and Open design mode and add buttons i need but i found behind button in the event-click code VB and i don't know code print document or close it so can anyone Help Me?

in VBA:

* print:
ActiveDocument.PrintOut Range:=wdPrintCurrentPage

* close:
The following example closes the document named "Report.doc" without saving changes:
Documents("Report.doc").Close SaveChanges:=wdDoNotSaveChanges

Share this answer
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900