Botão acionar Macro e Ferramentas Executar Macro

Algo estranho esta acontecendo em Win7 ( testei em LibO 5.3.0.3 e LibO 5.2.0.4 Portable )

Estando no “Editor Basic” utilizando “Entrar no processo(F8)” para executar a macro passo a passo funciona.

Porém quando executa por “Botão (Evento: Executar ação)” ou

Ferramentas / Macros / Executar macro” não funciona.

===> Alguém tem alguma dica do que pode ser

A macro é esta:

Sub NewForm2
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "novoproduto"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "final"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dim args2(5) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Flags"
args2(0).Value = "A"
args2(1).Name = "FormulaCommand"
args2(1).Value = 0
args2(2).Name = "SkipEmptyCells"
args2(2).Value = false
args2(3).Name = "Transpose"
args2(3).Value = false
args2(4).Name = "AsLink"
args2(4).Value = false
args2(5).Name = "MoveMode"
args2(5).Value = 1
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args2())
end sub

Mas o problema persiste…

Não descobri o motivo, mas aparentemente alguma “sujeira” no arquivo !

Refiz todo o arquivo e esta funcionando…