Home

Problem with text toolbox in connection with printing

%3CLINGO-SUB%20id%3D%22lingo-sub-637393%22%20slang%3D%22en-US%22%3EProblem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-637393%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20created%20an%20excel%20form%20in%20O365.%3CBR%20%2F%3EThere%20i%20have%20set%20a%20text%20toolbox%20with%20(steuerelement)%20a%20scrollbar.%20to%20be%20able%20to%20enter%20a%20lot%20of%20text.%3CBR%20%2F%3EIf%20I%20enter%20now%20much%20text%2C%20so%20that%20the%20scrollbar%20becomes%20active%2C%20and%20i%20print%20then%20only%20the%20displayed%20text%20is%20printed%20but%20not%20the%20text%20actually%20contained.%3CBR%20%2F%3EI%20would%20like%20to%20print%20the%20entire%20text!%3CBR%20%2F%3E%3CBR%20%2F%3EAbout%20help%20i%20would%20be%20happy%20!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-637393%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-638548%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-638548%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F347252%22%20target%3D%22_blank%22%3E%40SteVer1880%3C%2FA%3E%20Suppose%20your%20textbox%20is%20named%20TextBox1%20and%20the%20codename%20of%20the%20worksheet%20it%20is%20on%20is%20Sheet1.%20Enter%20this%20code%20in%20the%20ThisWorkbook%20module%3A%3C%2FP%3E%0A%3CPRE%3EOption%20Explicit%0A%0APublic%20OldHeight%20As%20Double%0APublic%20OldWidth%20As%20Double%0A%0APrivate%20Sub%20Workbook_BeforePrint(Cancel%20As%20Boolean)%0A%20%20%20%20If%20ActiveSheet.Name%20%3D%20%22Sheet1%22%20Then%0A%20%20%20%20%20%20%20%20OldHeight%20%3D%20Sheet1.TextBox1.Height%0A%20%20%20%20%20%20%20%20OldWidth%20%3D%20Sheet1.TextBox1.Width%0A%20%20%20%20%20%20%20%20Sheet1.TextBox1.AutoSize%20%3D%20True%0A%20%20%20%20End%20If%0A%20%20%20%20Application.OnTime%20Now%2C%20%22ReSizeBox%22%0AEnd%20Sub%0A%3C%2FPRE%3E%0A%3CP%3EInsert%20a%20module%20and%20enter%20this%20code%20into%20it%3A%3C%2FP%3E%0A%3CPRE%3EOption%20Explicit%0A%0ASub%20ReSizeBox()%0A%20%20%20%20With%20Sheet1.TextBox1%0A%20%20%20%20%20%20%20%20.AutoSize%20%3D%20False%0A%20%20%20%20%20%20%20%20.Height%20%3D%20ThisWorkbook.OldHeight%0A%20%20%20%20%20%20%20%20.Width%20%3D%20ThisWorkbook.OldWidth%0A%20%20%20%20End%20With%0AEnd%20Sub%0A%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-642945%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-642945%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3Bthank%C2%B4s%20for%20your%20support.%3C%2FP%3E%3CP%3EPlease%20check%20my%20VBA-config%20(attachment)-%20i'm%20not%20shure%20if%20it%20is%20correct.%3C%2FP%3E%3CP%3EVBA%20is%20not%20my%20speciality%20%3A-(%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-642961%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-642961%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3Eand%20a%20second%20appendix%20with%20an%20error%20when%20compiling.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-643618%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-643618%22%20slang%3D%22en-US%22%3ERelpace%20all%20%22Sheet1.%22%20with%20%22Tabelle1.%22%20(including%20the%20period%20but%20excluding%20the%20quotation%20marks).%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-649323%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-649323%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%2C%20but%20it%20doesn't%20work.%26nbsp%3BUnfortunately%2C%20not%20all%20content%20is%20printed%20yet.%3C%2FP%3E%3CP%3EIn%20my%20case%2C%20the%20function%20with%20rezice%20before%20print%26nbsp%3Bdoes%20not%20seem%20to%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'am%20sorry%20!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-650205%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-650205%22%20slang%3D%22en-US%22%3EWHat%20happens%20if%20you%20do%20a%20print%20preview%2C%20does%20it%20show%20all%20content%20of%20the%20textbox%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-650419%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-650419%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eno%2C%20there%20will%20be%20only%20the%20visible%20text%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-663753%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-663753%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecan%20you%20help%20me%20once%20again%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-663809%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-663809%22%20slang%3D%22en-US%22%3ESure%2C%20I'll%20try%20to%20%3A-)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699260%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699260%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20now%20it%20works%20!!!%20Thx.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20have%20a%20further%20question%3A%3CBR%20%2F%3EHow%20can%20i%20print%20more%20than%20one%20text%20boxes%3F%20I%20have%205%20text%20boxes%20in%20the%20sheet.%3CBR%20%2F%3EPlease%20tell%20me%20the%20correct%20vba-config.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EMany%20greets%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699535%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699535%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F347252%22%20target%3D%22_blank%22%3E%40SteVer1880%3C%2FA%3E%20That%20is%20slightly%20more%20complicated%20as%20we%20have%20to%20record%20the%20heights%20and%20widths%20of%20all%20textboxes%20prior%20to%20changing%20them%3A%3C%2FP%3E%0A%3CPRE%3EOption%20Explicit%0A%0ADim%20OldHeights()%20As%20Double%0ADim%20OldWidths()%20As%20Double%0A%0APrivate%20Sub%20Workbook_BeforePrint(Cancel%20As%20Boolean)%0A%20%20%20%20Dim%20Obj%20As%20Object%0A%20%20%20%20Dim%20lCt%20As%20Long%0A%20%20%20%20ReDim%20OldHeights(1%20To%201)%0A%20%20%20%20ReDim%20OldWidths(1%20To%201)%0A%20%20%20%20If%20ActiveSheet.Name%20%3D%20%22Sheet1%22%20Then%0A%20%20%20%20%20%20%20%20For%20Each%20Obj%20In%20Sheet1.OLEObjects%0A%20%20%20%20%20%20%20%20%20%20%20%20If%20TypeName(Obj.Object)%20%3D%20%22TextBox%22%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20lCt%20%3D%20lCt%20%2B%201%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ReDim%20Preserve%20OldHeights(1%20To%20lCt)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ReDim%20Preserve%20OldWidths(1%20To%20lCt)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20With%20Obj%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20OldHeights(lCt)%20%3D%20.Height%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20OldWidths(lCt)%20%3D%20.Width%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Object.AutoSize%20%3D%20True%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20End%20With%0A%20%20%20%20%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20%20%20%20%20Next%0A%20%20%20%20End%20If%0A%20%20%20%20Application.OnTime%20Now%2C%20%22'%22%20%26amp%3B%20ThisWorkbook.FullName%20%26amp%3B%20%22'!thisworkbook.ReSizeBox%22%0AEnd%20Sub%0A%0APublic%20Sub%20ReSizeBox()%0A%20%20%20%20Dim%20Obj%20As%20Object%20%20%20%20'msforms.TextBox%0A%20%20%20%20Dim%20lCt%20As%20Long%0A%20%20%20%20For%20Each%20Obj%20In%20Sheet1.OLEObjects%0A%20%20%20%20%20%20%20%20If%20TypeName(Obj.Object)%20%3D%20%22TextBox%22%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20lCt%20%3D%20lCt%20%2B%201%0A%20%20%20%20%20%20%20%20%20%20%20%20With%20Obj%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Object.AutoSize%20%3D%20False%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Height%20%3D%20OldHeights(lCt)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.Width%20%3D%20OldWidths(lCt)%0A%20%20%20%20%20%20%20%20%20%20%20%20End%20With%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20Next%0AEnd%20Sub%0A%0A%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-702468%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-702468%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20use!%3C%2FP%3E%3CP%3EI%20have%20tested%20the%20current%20config%2C%20unfortunately%20it%20does%20not%20work%20as%20desired.%3C%2FP%3E%3CP%3EA%20screenshot%20of%20the%20application%2C%20the%20config%20and%20the%20printer%20result%20is%20in%20the%20appendix%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-705626%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-705626%22%20slang%3D%22en-US%22%3ECan%20you%20please%20post%20the%20workbook%20rather%20than%20a%20screenshot%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-705985%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-705985%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehere%20it%20is%20%3A-)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-706186%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-706186%22%20slang%3D%22en-US%22%3EMove%20the%20code%20to%20the%20%22Diesearbeitsmappe%22%20module%20and%20in%20the%20code%2C%20replace%20%22Thisworkbook%22%20with%20%22Diesearbeitsmappe%22.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-713155%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-713155%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethx%20for%20the%20info!%20So%20far%20so%20good%20-%20but%20there%20is%20the%20next%20surprise.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20extendet%20textboxes%20are%20overlap.%26nbsp%3BIs%20there%20a%20way%20to%20dynamically%20move%20the%20other%20text%20in%20the%20textboxes%20an%20the%20normal%20text%20(in%20this%20case%20%22TextBox2%22)%3F%20-%26gt%3B%20See%20the%20Screenshot%20!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20do%20you%20mean%20-%20i'm%20on%20the%20right%20way%20to%20create%20a%20functionall%20solution%20or%20should%20i%20think%20about%20my%20idea%20idea%20to%20realise%20the%20form%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-713233%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-713233%22%20slang%3D%22en-US%22%3ETo%20be%20honest%2C%20I%20don't%20know%20a%20really%20solid%20solution%20for%20this.%20We%20could%3A%3CBR%20%2F%3E1.%20Remember%20the%20tops%20of%20each%20textbox%20and%20move%20textboxes%202-n%20down%20if%20needed%3CBR%20%2F%3E2.%20If%20a%20textbox%20becomes%20taller%20than%20a%20given%20number%2C%20first%20remember%20its%20width%20and%20make%20it%20wider%20before%20setting%20it%20to%20autosize%3CBR%20%2F%3EOption%201%20may%20mean%20the%20textbox%20spills%20to%20a%20next%20sheet%20of%20paper%20when%20printing%20(Don't%20even%20know%20if%20the%20last%20one%20will%20print%20if%20it%20spills%20over%20if%20your%20print%20area%20is%20too%20small%3F)%3CBR%20%2F%3EOption%202%20will%20nog%20guarantee%20they%20don't%20overlap%3CBR%20%2F%3EExcel%20is%20not%20the%20best%20program%20to%20use%20when%20it%20comes%20to%20printing%20large%20amounts%20of%20texts.%20More%20than%20~1000%20characters%20quickly%20becomes%20cumbersome.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715985%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715985%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20Morning%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethx%20for%20your%20great%20support.%20At%20the%20weekend%20i%C2%B4m%20created%20a%20form%20with%20ms%20word.%20I%20think%20it%20is%20the%20better%20way%20to%20solve%20my%20problems%20-%20an%20what%20should%20i%20say%20-%26gt%3B%20it%20work%60s.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'am%20thankfull%20of%20your%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regard%C2%B4s%3C%2FP%3E%3CP%3ESteffen%20Verf%C3%BCrth%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-716178%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20text%20toolbox%20in%20connection%20with%20printing%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-716178%22%20slang%3D%22en-US%22%3EExcellent%2C%20glad%20you%20were%20able%20to%20solve%20the%20issue.%3C%2FLINGO-BODY%3E
SteVer1880
Occasional Contributor

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

@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

@Jan Karel Pieterse thank´s for your support.

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

VBA is not my speciality :-(

@Jan Karel Pieterseand a second appendix with an error when compiling.

Relpace all "Sheet1." with "Tabelle1." (including the period but excluding the quotation marks).

@Jan Karel Pieterse 

 

Sorry, but it doesn't work. Unfortunately, not all content is printed yet.

In my case, the function with rezice before print does not seem to work.

 

I'am sorry !

WHat happens if you do a print preview, does it show all content of the textbox?

@Jan Karel Pieterse 

 

no, there will be only the visible text

@Jan Karel Pieterse 

can you help me once again?

Sure, I'll try to :-)

@Jan Karel Pieterse 

 

So, now it works !!! Thx.


I have a further question:
How can i print more than one text boxes? I have 5 text boxes in the sheet.
Please tell me the correct vba-config.


Many greets

@SteVer1880 That is slightly more complicated as we have to record the heights and widths of all textboxes prior to changing them:

Option Explicit

Dim OldHeights() As Double
Dim OldWidths() As Double

Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Dim Obj As Object
    Dim lCt As Long
    ReDim OldHeights(1 To 1)
    ReDim OldWidths(1 To 1)
    If ActiveSheet.Name = "Sheet1" Then
        For Each Obj In Sheet1.OLEObjects
            If TypeName(Obj.Object) = "TextBox" Then
                lCt = lCt + 1
                ReDim Preserve OldHeights(1 To lCt)
                ReDim Preserve OldWidths(1 To lCt)
                With Obj
                    OldHeights(lCt) = .Height
                    OldWidths(lCt) = .Width
                    .Object.AutoSize = True
                End With
            End If
        Next
    End If
    Application.OnTime Now, "'" & ThisWorkbook.FullName & "'!thisworkbook.ReSizeBox"
End Sub

Public Sub ReSizeBox()
    Dim Obj As Object    'msforms.TextBox
    Dim lCt As Long
    For Each Obj In Sheet1.OLEObjects
        If TypeName(Obj.Object) = "TextBox" Then
            lCt = lCt + 1
            With Obj
                .Object.AutoSize = False
                .Height = OldHeights(lCt)
                .Width = OldWidths(lCt)
            End With
        End If
    Next
End Sub

@Jan Karel Pieterse 

 

Thanks for your use!

I have tested the current config, unfortunately it does not work as desired.

A screenshot of the application, the config and the printer result is in the appendix

Can you please post the workbook rather than a screenshot?
Move the code to the "Diesearbeitsmappe" module and in the code, replace "Thisworkbook" with "Diesearbeitsmappe".

@Jan Karel Pieterse 

 

Hi,

 

thx for the info! So far so good - but there is the next surprise.

 

The extendet textboxes are overlap. Is there a way to dynamically move the other text in the textboxes an the normal text (in this case "TextBox2")? -> See the Screenshot !

 

What do you mean - i'm on the right way to create a functionall solution or should i think about my idea idea to realise the form ?

To be honest, I don't know a really solid solution for this. We could:
1. Remember the tops of each textbox and move textboxes 2-n down if needed
2. If a textbox becomes taller than a given number, first remember its width and make it wider before setting it to autosize
Option 1 may mean the textbox spills to a next sheet of paper when printing (Don't even know if the last one will print if it spills over if your print area is too small?)
Option 2 will nog guarantee they don't overlap
Excel is not the best program to use when it comes to printing large amounts of texts. More than ~1000 characters quickly becomes cumbersome.

@Jan Karel Pieterse 

 

Good Morning,

 

thx for your great support. At the weekend i´m created a form with ms word. I think it is the better way to solve my problems - an what should i say -> it work`s.

 

I'am thankfull of your help.

 

Best regard´s

Steffen Verfürth

Excellent, glad you were able to solve the issue.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
21 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies