Record macro

Not sure where to post? Post here!

Record macro

Postby mitduffy » Sat May 19, 2018 2:43 pm

Objective- Learn how to use “Record Macro”
Plan for practice recording 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
Open Office 5.4 on Windows 7
mitduffy
 
Posts: 2
Joined: Sun May 13, 2018 6:38 pm

Re: Record macro

Postby John_Ha » Sat May 19, 2018 3:28 pm

See the answers to your post in the Macros and UNO API forum.
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Manual, the Writer FAQ, the Writer Tutorials and the Writer guide.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6355
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK


Return to Beginners

Who is online

Users browsing this forum: No registered users and 4 guests