![]() |
#1
|
|||
|
|||
![]()
New to the use of VBA and Macro's in word documents.
I am trying to create a macro button\maco, that when clicked will print certain sections of a word document. I have it *almost* working, but with a slight hiccup. When I run the macro, it prints 3 copies of the document. 2, of the whole document, and the 3rd copy is the range I am looking for. Here is the code I have so far. Am I missing something? Sub Fileprint() ActiveDocument.ActiveWindow.PrintOut Dialogs(wdDialogFilePrint).Show With Application.ActiveDocument ActiveDocument.ActiveWindow.PrintOut _ Range:=wdPrintFromTo, From:="2", To:="3" End With End Sub Any help is appreciated! |
#2
|
|||
|
|||
![]()
Your code first calls
which prints a full copy of the document. Then it calls which prints a second copy. Finally it calls the only part you actually need |
#3
|
|||
|
|||
![]()
Ahhh!! Ok!! Now it sort of makes a little more sense! Big thank you!
Hopefully you can help me with the issue that led to the insertion of "Dialogs(wdDialogFilePrint).Show" That line seemed to give me what I thought was the "print dialog" box, which allowed me to select the printer I needed. Am I incorrect in thinking that? Without it, the document would only print to whatever my default printer was set at. Is there a way to make that happen? |
#4
|
|||
|
|||
![]()
See Application.ActivePrinter property (Word) | Microsoft Learn
Dialogs have several methods with important differences. See: Dialog.Display method (Word) | Microsoft Learn Dialog.Execute method (Word) | Microsoft Learn Dialog.Show method (Word) | Microsoft Learn |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Printer prints 2 copies. One with macros enabled and other one is disabled. | zhansultan | Word VBA | 0 | 05-21-2024 03:06 AM |
![]() |
SSCMapletart | Word VBA | 3 | 04-18-2017 03:04 AM |
Create multiple copies of same email in multiple folders | gaker10 | Outlook | 0 | 10-06-2014 07:44 AM |
![]() |
zip p pong | Word | 1 | 03-16-2014 08:56 PM |
Merging Multiple Copies of the Same Document | bshatto | Word | 0 | 10-19-2009 06:22 AM |