Forum Discussion

SteVer1880's avatar
SteVer1880
Copper Contributor
May 23, 2019

Problem with text toolbox in connection with printing

I have created an excel form in O365.
There i have set a text toolbox with (steuerelement) a scrollbar. to be able to enter a lot of text.
If I enter now much text, so that the scrollbar becomes active, and i print then only the displayed text is printed but not the text actually contained.
I would like to print the entire text!

About help i would be happy !

19 Replies

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    SteVer1880 Suppose your textbox is named TextBox1 and the codename of the worksheet it is on is Sheet1. Enter this code in the ThisWorkbook module:

    Option Explicit
    
    Public OldHeight As Double
    Public OldWidth As Double
    
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
        If ActiveSheet.Name = "Sheet1" Then
            OldHeight = Sheet1.TextBox1.Height
            OldWidth = Sheet1.TextBox1.Width
            Sheet1.TextBox1.AutoSize = True
        End If
        Application.OnTime Now, "ReSizeBox"
    End Sub
    

    Insert a module and enter this code into it:

    Option Explicit
    
    Sub ReSizeBox()
        With Sheet1.TextBox1
            .AutoSize = False
            .Height = ThisWorkbook.OldHeight
            .Width = ThisWorkbook.OldWidth
        End With
    End Sub
    
      • JKPieterse's avatar
        JKPieterse
        Silver Contributor
        Relpace all "Sheet1." with "Tabelle1." (including the period but excluding the quotation marks).
    • SteVer1880's avatar
      SteVer1880
      Copper Contributor

      JKPieterse thank´s for your support.

      Please check my VBA-config (attachment)- i'm not shure if it is correct.

      VBA is not my speciality :-(

Resources