PDA

View Full Version : Excel comments: a registered macro that doesn't work



Vundra
02-10-2017, 09:53 AM
I've registered a macro with Excel 2007 in order to look how to regulate the internal margins of a comment with a text inside.
The macro that I automatically obtain is:


Sub Macro1()
Range("A1").Comment.Shape.Select True
Selection.ShapeRange.TextFrame.MarginLeft = 34.02
Selection.ShapeRange.TextFrame.MarginRight = 19.84
Selection.ShapeRange.TextFrame.MarginTop = 19.84
Selection.ShapeRange.TextFrame.MarginBottom = 19.84
End Sub

but when I run this macro the only thing that I see is the comment shape selection; the internal margins of the text remain unaltered.
I've noticed two facts:
1) there is a check box "Automatic" inside the Margins dialog but no trace about its selection inside the macro.
2) if I insert in cell A1 a comment with internal margins previously altered the Macro1 brings again the comment text always in these positions (different from macro's values):


.MarginLeft = 5.67
.MarginRight = 9.92
.MarginTop = 3.69
.MarginBottom = 6.52

That's really very strange! :banghead:
How is possible to solve this issue?
Thanks.