PDA

View Full Version : Bug: macro is freezing ribbon on word 2007



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

rv.aleixo.al
04-22-2013, 02:13 AM
In fact, any macro I run freezes the ribbon.
Does anyone as ever had a problem like this?
It's very annoying.

(I have a macro that performs a function, but none that performs a loop, so....)

macropod
04-22-2013, 04:33 AM
Have you tried repairing the Office installation (via Word Options|Resources|Diagnose)?

PS: When posting code, please use the VBA code tags. They're on the menu.

rv.aleixo.al
04-30-2013, 11:32 AM
Thanks, Paul!
I didn't noticed the VBA tags. Sorry about that.
Yes I have run a diagnose and everything seems ok.
The problem seems to solves by itself when I click the tab of the word in the start menu bar in windows to minimize word and then again to maximize. Mysterious...

Paul_Hossler
04-30-2013, 05:27 PM
move any addins, templates, etc out of the Word Startup folder:

C:\Users\<youruserid>\AppData\Roaming\Microsoft\Word\STARTUP

and see if that makes any difference


Also move any other addins, etc. somewhere out of the way if that doesn't work

Good Luck

Paul