PDA

View Full Version : Solved: Print text box contents in a userform



austenr
08-16-2007, 09:33 AM
How do you print the contents of a text box in a userform?

Bob Phillips
08-16-2007, 10:07 AM
Just the textbox, or the userform?

Bob Phillips
08-16-2007, 10:08 AM
Just the textbox, or the userform?

austenr
08-16-2007, 10:10 AM
Hi Bob,

I got this to work ok by using

UserForm1.PrintForm

My sticking point now is how do you either export or save a userform to your desktop so you can open it and read it? Maybe save it as an HTML or something? Thanks

Bob Phillips
08-16-2007, 10:12 AM
Export the file, and you can open that in any text editor.

austenr
08-16-2007, 10:16 AM
I found this code but could it be modified to work as you described?

Private Sub CommandButton2_Click()
Dim filename As String
filename = Application.GetSaveAsFilename("CCPE Instructions", "Excel (*.xls),*.xls")
If filename <> "" And filename <> "False" Then
ActiveWorkbook.SaveAs filename
End If
End Sub

austenr
08-16-2007, 10:17 AM
I found this code but could it be modified to work as you described?

Private Sub CommandButton2_Click()
Dim filename As String
filename = Application.GetSaveAsFilename("CCPE Instructions", "Excel (*.xls),*.xls")
If filename <> "" And filename <> "False" Then
ActiveWorkbook.SaveAs filename
End If
End Sub

austenr
08-16-2007, 10:24 AM
:SHOCKED: Sorry I posted my reply twice.

Bob Phillips
08-16-2007, 11:12 AM
This is the sort of thing I meant Austen



Workbooks("Book1").VBProject.VBComponents("Userform1").Export _
Filename:="C:\temp.frm"


and



Workbooks("Book3").VBProject.VBComponents.Import _
Filename:="C:\temp.frm"

austenr
08-16-2007, 11:13 AM
I will give it a go. Thanks Bob.