Ask Your Question
0

Change Recorded Macro to work on different files?

asked 2015-06-11 20:20:41 +0200

Kirk gravatar image

I created this macro recording using the standard filter to leave only rows that do not end with the letter "A" in a serial number column. However, when I try to use it on a different file (or workbook, I'm not sure if that means the same thing), it does not work. How can you make a macro work independently from the file in which it was created?

REM BASIC

sub Main 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:DataFilterStandardFilter", "", 0, Array())

rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:FilterExecute", "", 0, Array())

rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:DataAreaRefresh", "", 0, Array())

end sub

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-06-11 20:40:52 +0200

Alex Kemp gravatar image

It is a question of where it is stored, Kirk.

You are asked at macro save where you want it to be stored. If you choose the document, then it will be available only to that file. If within your profile, then available to all docs that you run. And so on.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-06-11 20:20:41 +0200

Seen: 154 times

Last updated: Jun 11 '15