On Feb 16, 8:28 am, Roderick O'Regan
> Is there a way, please, to print the text contents of a large userform
> To explain: A template has a userform which gets data from a database
> (an Excel file). The userform has a combo box showing the title from
> one cell. The long and expanded contents of the adjoing cell then
> displays in the large userform textbox.
> No problems up to this stage. However, the client has now asked me for
> the facility to directly print out the contents of that large textbox
> in case the user wants to take a more considered review of the text.
> The user would press a "Print it" button on the userform.
> Can this be done?
> Checking the Print commands in VBA seems to display examples of only
> printing the document created from the template.
The following code is crude, but shows that it could be done:
Private Sub PrintButton_Click()
Dim oScratchPad As Word.Document
Set oScratchPad = Documents.Add
oScratchPad.Range.Text = Me.TextBox1.Text
It simply creates a new document, sticks in the textbox text, prints
it, and closes.
To gussy it up some, you might create a template that opens with some
boilerplate text, etc and set oScratchpad to a new document based on
that template and stick the textbox text in the proper place.