rv.aleixo.al
04-20-2013, 11:05 AM
Hi everyone,
I'm having a problem with a macro that's freezing the ribbon on word 2007.
It's a simple macro, it just do some formats to a picture in a cell of a table in Word. I've personalized the tools bar in the ribbon adding a button for the macro.
It's not always, which is strange, but when I run the macro, the button of the macro remains marked as if was being pressed and the ribbon freezes. I can't accede to any button in the ribbon or perform any action. I can write or use keyboard shortcuts, format using mouse right click, and other functions, but the ribbon is freezed. I have to exit the document, word asks me to save my document, and when I reopen the document, everything seems normal. Any other document I have open when this happens, is not affected by this.
If I use again the macro it freezes again.
Does anyone have any suggestion?
Thank you all!
Ricardo
Annex: Here goes the code of the macro.
Sub FDiagCoord()
'
' Formatar os diagramas que têm coordenadas.
'
On Error GoTo ErrorHandler
Set oILS = Selection.InlineShapes(1)
With oILS
.PictureFormat.CropLeft = CentimetersToPoints(0.6)
.PictureFormat.CropTop = CentimetersToPoints(0.4)
.PictureFormat.CropRight = CentimetersToPoints(0.6)
.PictureFormat.CropBottom = CentimetersToPoints(0.4)
.LockAspectRatio = True
.ScaleHeight = 60
End With
Set oShp = Selection.InlineShapes(1).ConvertToShape
oShp.WrapFormat.Type = wdWrapTopBottom
oShp.ZOrder msoSendToBack
With oShp
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = wdShapeCenter
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.Top = 0
End With
Exit Sub
ErrorHandler:
End Sub
I'm having a problem with a macro that's freezing the ribbon on word 2007.
It's a simple macro, it just do some formats to a picture in a cell of a table in Word. I've personalized the tools bar in the ribbon adding a button for the macro.
It's not always, which is strange, but when I run the macro, the button of the macro remains marked as if was being pressed and the ribbon freezes. I can't accede to any button in the ribbon or perform any action. I can write or use keyboard shortcuts, format using mouse right click, and other functions, but the ribbon is freezed. I have to exit the document, word asks me to save my document, and when I reopen the document, everything seems normal. Any other document I have open when this happens, is not affected by this.
If I use again the macro it freezes again.
Does anyone have any suggestion?
Thank you all!
Ricardo
Annex: Here goes the code of the macro.
Sub FDiagCoord()
'
' Formatar os diagramas que têm coordenadas.
'
On Error GoTo ErrorHandler
Set oILS = Selection.InlineShapes(1)
With oILS
.PictureFormat.CropLeft = CentimetersToPoints(0.6)
.PictureFormat.CropTop = CentimetersToPoints(0.4)
.PictureFormat.CropRight = CentimetersToPoints(0.6)
.PictureFormat.CropBottom = CentimetersToPoints(0.4)
.LockAspectRatio = True
.ScaleHeight = 60
End With
Set oShp = Selection.InlineShapes(1).ConvertToShape
oShp.WrapFormat.Type = wdWrapTopBottom
oShp.ZOrder msoSendToBack
With oShp
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = wdShapeCenter
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.Top = 0
End With
Exit Sub
ErrorHandler:
End Sub