Vba Word Printout Exampes
-->Sample Interview Questions with Suggested Ways of Answering Q. Tell me about yourself. This is the dreaded, classic, open-ended interview question and likely to be among the first. Here is the sample Word document with 3 sample comments inserted into it: Here is how to print these comments as a separate Word document. (1) Open your Word document that includes all the comments. (2) Press ALT + F11 to display the VBA editing screen. (3) Insert a new module by selecting Insert Module from the menu.
PrintOut method as it applies to the Application, Document, and Window objects.
Prints all or part of the specified document.
expression.PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)
expression Required. An expression that returns one of the above objects.
Background Optional Variant. Set to True to have the macro continue while Microsoft Word prints the document.
Append Optional Variant. Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName.
WdPrintOutRange
wdPrintAllDocument |
wdPrintCurrentPage |
wdPrintFromTo |
wdPrintRangeOfPages |
wdPrintSelection |
OutputFileName Optional Variant. If PrintToFile is True, this argument specifies the path and file name of the output file.
From Optional Variant. The starting page number when Range is set to wdPrintFromTo.
To Optional Variant. The ending page number when Range is set to wdPrintFromTo.
WdPrintOutItem
wdPrintAutoTextEntries |
wdPrintComments |
wdPrintDocumentContent |
wdPrintDocumentWithMarkup |
wdPrintEnvelope |
wdPrintKeyAssignments |
wdPrintMarkup |
wdPrintProperties |
wdPrintStyles |
Copies Optional Variant. The number of copies to be printed.
Pages Optional Variant. The page numbers and page ranges to be printed, separated by commas. For example, '2, 6-10' prints page 2 and pages 6 through 10.
WdPrintOutPages
wdPrintAllPages |
wdPrintEvenPagesOnly |
wdPrintOddPagesOnly |
PrintToFile Optional Variant. True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate Optional Variant. When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName Optional Variant. The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.)
ActivePrinterMacGX Optional Variant. This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrint Optional Variant. True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
PrintZoomColumn Optional Variant. The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRow Optional Variant. The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidth Optional Variant. The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight Optional Variant. The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintOut method as it applies to the Envelope object.
Prints an envelope without adding the envelope to the active document.
expression.PrintOut(ExtractAddress, Address, AutoText, OmitReturnAddress, ReturnAddress, ReturnAutoText, PrintBarCode, PrintFIMA, Size, Height, Width, FeedSource, AddressFromLeft, AddressFromTop, ReturnAddressFromLeft, ReturnAddressFromTop, DefaultFaceUp, DefaultOrientation, PrintEPostage, Vertical, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop)
Vba Word Printout Exampes For Kids
expression Required. An expression that returns an Envelope object.
ExtractAddress Optional Variant. True to use the text marked by the 'EnvelopeAddress' bookmark (a user-defined bookmark) as the recipient's address.
Address Optional Variant. A string that specifies the recipient's address (ignored if ExtractAddress is True).
AutoText Optional Variant. The name of the AutoText entry that includes a recipient's address. Revit 2014 crack xforce 64 bit free download.
OmitReturnAddress Optional Variant. True to omit the return address.
ReturnAddress Optional Variant. A string that specifies the return address.
ReturnAutoText Optional Variant. The name of the AutoText entry that includes a return address.
PrintBarCode Optional Variant. True to add a POSTNET bar code. For U.S. mail only.
PrintFIMA Optional Variant. True to add a Facing Identification Mark (FIM-A) for use in presorting courtesy reply mail. For U.S. mail only.
Size Optional Variant. A string that specifies the envelope size. The string should match one of the sizes listed on the left side of the Envelope size box in the Envelope Options dialog box (for example, 'Size 10').
Height Optional Variant. The height of the envelope (in points) when the Size argument is set to 'Custom size.'
Width Optional Variant. The width of the envelope (in points) when the Size argument is set to 'Custom size.'
FeedSource Optional Variant. True to use the FeedSource property of the Envelope object to specify which paper tray to use when printing the envelope.
AddressFromLeft Optional Variant. The distance (in points) between the left edge of the envelope and the recipient's address.
AddressFromTop Optional Variant. The distance (in points) between the top edge of the envelope and the recipient's address.
ReturnAddressFromLeft Optional Variant. The distance (in points) between the left edge of the envelope and the return address.
ReturnAddressFromTop Optional Variant. The distance (in points) between the top edge of the envelope and the return address.
DefaultFaceUp Optional Variant. True to print the envelope face up; False to print it face down.
WdEnvelopeOrientation
wdLeftPortrait |
wdCenterPortrait |
wdRightPortrait |
wdLeftLandscape |
wdCenterLandscape |
wdRightLandscape |
wdLeftClockwise |
wdCenterClockwise |
wdRightClockwise |
PrintEPostage Optional Variant. True to print postage using an Internet e-postage vendor.
Vertical Optional Variant. True prints text vertically on the envelope. Used for Asian-language envelopes.
RecipientNamefromLeft Optional Variant. The position of the recipient's name, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
RecipientNamefromTop Optional Variant. The position of the recipient's name, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
RecipientPostalfromLeft Optional Variant. The position of the recipient's postal code, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
RecipientPostalfromTop Optional Variant. The position of the recipient's postal code, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
SenderNamefromLeft Optional Variant. The position of the sender's name, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
SenderNamefromTop Optional Variant. The position of the sender's name, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
SenderPostalfromLeft Optional Variant. The position of the sender's postal code, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
SenderPostalfromTop Optional Variant. The position of the sender's postal code, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
PrintOut method as it applies to the MailingLabel object.
Prints a label or a page of labels with the same address.
expression.PrintOut(Name, Address, ExtractAddress, LaserTray, SingleLabel, Row, Column, PrintEPostageLabel, Vertical)
expression Required. An expression that returns a MailingLabel object.
Name Optional Variant. The mailing label name.
Address Optional Variant. The text for the label address.
ExtractAddress Optional Variant. True to use the text marked by the 'EnvelopeAddress' bookmark (a user-defined bookmark) as the label text. If this argument is specified, Address and AutoText are ignored.
WdPaperTray
wdPrinterAutomaticSheetFeed |
wdPrinterDefaultBin |
wdPrinterEnvelopeFeed |
wdPrinterFormSource |
wdPrinterLargeCapacityBin |
wdPrinterLargeFormatBin |
wdPrinterLowerBin |
wdPrinterManualEnvelopeFeed |
wdPrinterManualFeed |
wdPrinterMiddleBin |
wdPrinterOnlyBin |
wdPrinterPaperCassette |
wdPrinterSmallFormatBin |
wdPrinterTractorFeed |
wdPrinterUpperBin |
SingleLabel Optional Variant. True to print a single label; False to print an entire page of the same label.
Row Optional Variant. The label row for a single label. Not valid if SingleLabel is False.
Column Optional Variant. The label column for a single label. Not valid if SingleLabel is False.
PrintEPostageLabel Optional Variant. True to print postage using an Internet e-postage vendor.
Vertical Optional Variant. True prints text vertically on the label. Used for Asian-language mailing labels.
Example
As it applies to the Application, Document, and Window objects.
This example prints the current page of the active document.
This example prints all the documents in the current folder. The Dir function is used to return all file names that have the file name extension '.doc'.
This example prints the first three pages of the document in the active window.
This example prints the comments in the active document.
This example prints the active document, fitting six pages on each sheet.
This example prints the active document at 75% of actual size.
As it applies to the Envelope object.
This example prints an envelope using the user address as the return address and a predefined recipient address.
As it applies to the MailingLabel object.
This example prints a page of Avery 5664 mailing labels, using the specified address.
Applies to Application Object Document Object Envelope Object MailingLabel Object Window Object
See Also ActivePrinter Property CreateNewDocument Method Envelope Object Insert Method MailingLabel Object PageSetup Property PrintEvenPagesInAscendingOrder Property PrintFractionalWidths Property PrintOddPagesInAscendingOrder Property UpdateDocument Method
Hi,
I have a Macro to update some DocVariables then for me to select which printer I wish to use from a list of 2.
I am using the procedure from an Excel Macro that I've set before, but it is not working in word.
My problem is that my Input Box is in a loop that I cannot leave unless I press CTRL+BREAK.
Please can you have a look at my Check Input section BOLD below..
Please note that I would like the input to be checked that it is a Number, and that the number is 1 or 2, and if Cancel is Clicked then Exit Macro.
Sub PrintCheckList()
'PrintOut Time Change Check List
'Settings
'Variables
Dim PlusMinus As String
Dim ChangeHour As String
Dim Default_Printer_Name As String
Dim MyPrinter As String
Dim Printer_Name As String
Dim Printer_Name1 As String
Dim Printer_Name2 As String
Dim Printer_Name0 As Variant
'Defaults
Default_Printer_Name = Application.ActivePrinter
Printer_Name1 = 'Kodak ESP+7 on Ne01:'
Printer_Name2 = 'HP Photosmart B110a Series on Ne02:'
PlusMinus = '
ChangeHour = '
'Set Change Details
If Month(Now()) = '3' Then
PlusMinus = '+'
ChangeHour = '1:00am'
Else
PlusMinus = '-'
ChangeHour = '2:00pm'
End If
'Update the Document
With ActiveDocument
.Variables('PlusMinus').Value = PlusMinus
.Variables('ChangeHour').Value = ChangeHour
End With
'Update all Field Codes
For Each FCRange In ActiveDocument.StoryRanges
For Each FCField In FCRange.Fields
FCField.Update
Next FCField
Next FCRange
Question:
'Question to Set the Printer to Use
Printer_Name0 = InputBox('Please select the Printer you wish to use..' + Chr(10) _
+ Chr(10) _
+ ' Please enter the Number for the Printer..' + Chr(10) _
+ Chr(10) _
+ ' 1. ' + Left(Printer_Name1, Len(Printer_Name1) - 9) + '.' + Chr(10) _
+ ' 2. ' + Left(Printer_Name2, Len(Printer_Name2) - 9) + '.' + Chr(10) _
+ Chr(10) _
+ ' The Current Printer is ' + Chr(147) + Default_Printer_Name _
+ Chr(148) + '.' + Chr(10) _
+ Chr(10), 'Print Video Tickets..', 1)
'Check Input
If Printer_Name0 = vbCancel Then
Exit Sub
ElseIf Not IsNumeric(Printer_Name0) Or Printer_Name0 < 1 Or _
Printer_Name0 > 2 Then
GoTo Question
End If
'Goto Printer from your Selection
If Printer_Name0 = '1' Then
GoTo Printer1
ElseIf Printer_Name0 = '2' Then
GoTo Printer2
End If
Printer1:
Printer_Name = Printer_Name1
Application.ActivePrinter = Printer_Name
GoTo Print_Out
Printer2:
Printer_Name = Printer_Name2
Application.ActivePrinter = Printer_Name
Print_Out:
ActiveDocument.ActiveWindow.PrintOut _
Range:=wdPrintFromTo, _
From:='1', _
To:='1'
Cancel:
Application.ActivePrinter = Default_Printer_Name
End Sub
Thank you in advance,
Neil