[Solved] Macro not doing anything

Creating a macro - Writing a Script - Using the API

[Solved] Macro not doing anything

Postby rztv8076 » Mon Jun 24, 2019 10:06 pm

I have recorded a macro to do Text to Columns procedure. Here is recorded code. When I run the macro - nothing happens and selected cell is still selected. When I perform macro keystrokes, all works fine.
anybody see an error or have an idea?
thanks in advance.

Code: Select all   Expand viewCollapse view
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:TextToColumns", "", 0, Array())

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

end sub
Last edited by Hagar Delest on Tue Jun 25, 2019 10:35 pm, edited 1 time in total.
Reason: tagged solved
OpenOffice 6.2.4.2 on Windows 7
rztv8076
 
Posts: 6
Joined: Mon Jun 24, 2019 9:59 pm

Re: macro not doing anything

Postby JeJe » Mon Jun 24, 2019 10:59 pm

Works for me... the TextToColumns dialog box pops up - provided there's a valid selection... check the Data/Text to Columns menu entry is not greyed before you run the macro is all I can suggest.

And remove the Rem from before the line
dispatcher.executeDispatch(document, ".uno:TextToColumns", "", 0, Array())
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 737
Joined: Wed Mar 09, 2016 2:40 pm

Re: macro not doing anything

Postby rztv8076 » Mon Jun 24, 2019 11:08 pm

Still can't get it to run. i've lowered Security>Macro to minimum. Can you think of where else it might be blocked?
Text to Columns works fine when I do it manually, but I have another 3000 plus rows to do. Trying to "Not go insane".
thanks for your help.
RZ
OpenOffice 6.2.4.2 on Windows 7
rztv8076
 
Posts: 6
Joined: Mon Jun 24, 2019 9:59 pm

Re: macro not doing anything

Postby JeJe » Mon Jun 24, 2019 11:17 pm

Charlie Young has a suggestion that avoids the macro recorder here:

viewtopic.php?f=9&t=37246
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 737
Joined: Wed Mar 09, 2016 2:40 pm

Re: macro not doing anything

Postby rztv8076 » Mon Jun 24, 2019 11:27 pm

I see how this works. Still can't get it to run. I've either got a setting wrong or I'm not running macro correctly.
Tools>Macros>Run Macro>(Select proper macro)>Run

See anything wrong with this procedure? I'm on row 9958 with a bunch to go. Lots of ALT-D xx Enter Enter.

thanks for time and consideration.

RZ
OpenOffice 6.2.4.2 on Windows 7
rztv8076
 
Posts: 6
Joined: Mon Jun 24, 2019 9:59 pm

Re: macro not doing anything

Postby JeJe » Mon Jun 24, 2019 11:32 pm

You're not converting text to columns one row at a time surely?
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 737
Joined: Wed Mar 09, 2016 2:40 pm

Re: macro not doing anything

Postby rztv8076 » Mon Jun 24, 2019 11:33 pm

Surely I am. Can't select multiple rows - option greyed out.
OpenOffice 6.2.4.2 on Windows 7
rztv8076
 
Posts: 6
Joined: Mon Jun 24, 2019 9:59 pm

Re: macro not doing anything

Postby rztv8076 » Mon Jun 24, 2019 11:36 pm

OMG - can't select multiple rows but you can select column. Yikes. This works better.
Thanks for shaking my head to see what I was doing.

RZ
OpenOffice 6.2.4.2 on Windows 7
rztv8076
 
Posts: 6
Joined: Mon Jun 24, 2019 9:59 pm

Re: macro not doing anything

Postby JeJe » Mon Jun 24, 2019 11:37 pm

Yeah, you should be able to do it all in one go.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 737
Joined: Wed Mar 09, 2016 2:40 pm

Re: macro not doing anything

Postby rztv8076 » Mon Jun 24, 2019 11:38 pm

Thanks JeJe. major help.
OpenOffice 6.2.4.2 on Windows 7
rztv8076
 
Posts: 6
Joined: Mon Jun 24, 2019 9:59 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests