Objective- Practice using “record Macro”
Plan for practice macro
Transfer five digits from one file = “stored numbers” To a file named = “deposit numbers”
Problem:
Works correctly the first time it is run. Transfers the number from “stored number” to “deposit numbers”
If I then change the original number in “stored numbers” and run the macro a second time it does not insert the new number. Instead the original numbers remain displayed.
Recorded Macro
sub Storednumbers
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 ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:OpenFromCalc", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$G$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "ToPoint"
args4(0).Value = "$D$4"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4())
end sub
Any help appreciated