![]() |
Creating Shape at runtime
Good Evening,
Any suggestions how to "clean" below code? My code is working as intented but looks "amateurish". Brgds CG Rosén Range("A1").Select ActiveSheet.Shapes.AddTextEffect(msoTextEffect1, "Filed", "Sylfaen", 36#, _ msoFalse, msoFalse, 329.25, 188.25).Select Selection.ShapeRange.ScaleWidth 1.65, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 0.98, msoFalse, msoScaleFromBottomRight Selection.ShapeRange.IncrementRotation -26.33 Selection.ShapeRange.IncrementLeft -164.25 Selection.ShapeRange.IncrementTop 40.5 |
Creating Shape at runtime
I would use something like the following:
With ActiveSheet.Shapes.AddTextEffect(msoTextEffect1, _ "Filed", _ "Sylfaen", _ 36#, _ msoFalse, _ msoFalse, _ Range("D20").Left, _ Range("D20").Top) .ScaleWidth 1.65, msoFalse, msoScaleFromTopLeft .ScaleHeight 0.98, msoFalse, msoScaleFromBottomRight .IncrementRotation -26.33 .IncrementLeft 0 .IncrementTop 0 End With The top left of the original text is aligned with the D20 cell, which you can change to suit your spreadsheet layout and which will probably allow you to eliminate the IncrementLeft and IncrementTop lines.I have left them in if you want to add fine adjustments. The ScaleHeight line could also be eliminated if you are not too picky. It is only adjusting the height to 98% of its original height. -- John Green - Excel MVP Sydney Australia "CG Rosén" wrote in message ... Good Evening, Any suggestions how to "clean" below code? My code is working as intented but looks "amateurish". Brgds CG Rosén Range("A1").Select ActiveSheet.Shapes.AddTextEffect(msoTextEffect1, "Filed", "Sylfaen", 36#, _ msoFalse, msoFalse, 329.25, 188.25).Select Selection.ShapeRange.ScaleWidth 1.65, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 0.98, msoFalse, msoScaleFromBottomRight Selection.ShapeRange.IncrementRotation -26.33 Selection.ShapeRange.IncrementLeft -164.25 Selection.ShapeRange.IncrementTop 40.5 |
Creating Shape at runtime
Hi John,
Thanks for your answer! Brgds CG Rosén "John Green" wrote in message ... I would use something like the following: With ActiveSheet.Shapes.AddTextEffect(msoTextEffect1, _ "Filed", _ "Sylfaen", _ 36#, _ msoFalse, _ msoFalse, _ Range("D20").Left, _ Range("D20").Top) .ScaleWidth 1.65, msoFalse, msoScaleFromTopLeft .ScaleHeight 0.98, msoFalse, msoScaleFromBottomRight .IncrementRotation -26.33 .IncrementLeft 0 .IncrementTop 0 End With The top left of the original text is aligned with the D20 cell, which you can change to suit your spreadsheet layout and which will probably allow you to eliminate the IncrementLeft and IncrementTop lines.I have left them in if you want to add fine adjustments. The ScaleHeight line could also be eliminated if you are not too picky. It is only adjusting the height to 98% of its original height. -- John Green - Excel MVP Sydney Australia "CG Rosén" wrote in message ... Good Evening, Any suggestions how to "clean" below code? My code is working as intented but looks "amateurish". Brgds CG Rosén Range("A1").Select ActiveSheet.Shapes.AddTextEffect(msoTextEffect1, "Filed", "Sylfaen", 36#, _ msoFalse, msoFalse, 329.25, 188.25).Select Selection.ShapeRange.ScaleWidth 1.65, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 0.98, msoFalse, msoScaleFromBottomRight Selection.ShapeRange.IncrementRotation -26.33 Selection.ShapeRange.IncrementLeft -164.25 Selection.ShapeRange.IncrementTop 40.5 |
All times are GMT +1. The time now is 12:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com