Forum Discussion
SteVer1880
May 23, 2019Copper Contributor
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 ac...
JKPieterse
May 23, 2019Silver 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
SteVer1880
May 24, 2019Copper 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 :-(