Printing the selection

The following macro prints out the current selection (this is not supported in the Write print dialog – sometimes macros can be used as work-arounds for non-existent product features!)

Sub PrintSelection

Set currdoc = ActiveDocument 

Selection.Copy() 

Set tempdoc = Documents.Add("NORMAL") 

tempdoc.Paste() 

tempdoc.Print 1, 9999, 1, False 

currdoc.Activate 

End Sub

The macro first sets a reference to the current document (so it can re-display it at the end). Next, it copies the current selection to the clipboard.

The third line of the macro creates a new document, based on the normal template. This will be used as a temporary store for the selected text, which is pasted and printed.

Lastly, the macro returns to the original document using the Activate command.