Consulting

Results 1 to 10 of 10

Thread: Solved: Print text box contents in a userform

  1. #1
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location

    Solved: Print text box contents in a userform

    How do you print the contents of a text box in a userform?
    Peace of mind is found in some of the strangest places.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Just the textbox, or the userform?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by xld
    Just the textbox, or the userform?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Hi Bob,

    I got this to work ok by using

    [VBA]UserForm1.PrintForm[/VBA]

    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
    Peace of mind is found in some of the strangest places.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Export the file, and you can open that in any text editor.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    I found this code but could it be modified to work as you described?

    [VBA]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[/VBA]
    Peace of mind is found in some of the strangest places.

  7. #7
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    I found this code but could it be modified to work as you described?

    [VBA]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[/VBA]
    Peace of mind is found in some of the strangest places.

  8. #8
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Sorry I posted my reply twice.
    Peace of mind is found in some of the strangest places.

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    This is the sort of thing I meant Austen

    [vba]

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

    and

    [vba]

    Workbooks("Book3").VBProject.VBComponents.Import _
    Filename:="C:\temp.frm"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  10. #10
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    I will give it a go. Thanks Bob.
    Peace of mind is found in some of the strangest places.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •