Practice Recording macro [closed]

asked 2018-05-19 15:00:37 +0200

mitduffy gravatar image

updated 2018-05-19 15:23:38 +0200

Ratslinger gravatar image

Objective- Learn how to use “Record Macro” Plan for practice Record macro Transfer five digits from one file named “storednumbers”, to a file named “depositnumbers” 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 the “storednumbers” file and run the macro a second time it does not insert the new number in “depositednumbers” file. Instead the original numbers remain displayed in “deposited numbers”. Here then the Recorded Macro.

REM BASIC

sub macrotest1
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 = "$E$3"

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 = "$C$3"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4())


end sub

Any help appreciated

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Ratslinger
close date 2018-05-19 15:27:22.439906

Comments

@mitduffy This is nothing more than a duplicate of your post here (except for different cells) -> Record macro.

Please finish the question there and do not just duplicate questions.

Ratslinger gravatar imageRatslinger ( 2018-05-19 15:27:00 +0200 )edit