Wizard
10-26-2006, 07:11 AM
This has been puzzling me for some time and it has just cropped up again. Didn't find anything in the KB on this....
I have any number of instances where I add a cell comment, a text box or a button to a sheet using VBA. Setting the fonts, colors, all that good stuff is no problem UNTIL we try to set the margins.
I record a macro of setting the margins, and it gives me code like this:
daButton.ShapeRange.TextFrame.MarginLeft = 14.4
daButton.ShapeRange.TextFrame.MarginRight = 21.6
daButton.ShapeRange.TextFrame.MarginTop = 3.6
daButton.ShapeRange.TextFrame.MarginBottom = 3.6
('Selection' (as recorded) has been replaced with the object name in this example.)
But when I run the code, nothing happens. Everything else I tell it to do to the daButton object works fine... but the margins just won't budge.:banghead:
Where am I going wrong?
I have any number of instances where I add a cell comment, a text box or a button to a sheet using VBA. Setting the fonts, colors, all that good stuff is no problem UNTIL we try to set the margins.
I record a macro of setting the margins, and it gives me code like this:
daButton.ShapeRange.TextFrame.MarginLeft = 14.4
daButton.ShapeRange.TextFrame.MarginRight = 21.6
daButton.ShapeRange.TextFrame.MarginTop = 3.6
daButton.ShapeRange.TextFrame.MarginBottom = 3.6
('Selection' (as recorded) has been replaced with the object name in this example.)
But when I run the code, nothing happens. Everything else I tell it to do to the daButton object works fine... but the margins just won't budge.:banghead:
Where am I going wrong?