Ask Your Question
0

How to record a macro for text to columns???

asked 2016-08-04 18:31:13 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

the macro gets recorded but never executed if run....

edit retag flag offensive close merge delete

Comments

You should put some effort into your post. You could at least post the recorded code.

floris v gravatar imagefloris v ( 2016-08-04 22:07:03 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2016-08-04 22:05:39 +0200

floris v gravatar image

You shouldn't record macros in OpenOffice or LibreOffice. Or write them. Leave that to the experts, :(

That said, here's a sample:

    sub two_columns_2
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 ----------------------------------------------------------------------
dim args1(7) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Columns"
args1(0).Value = 3 : REM number of columns goes here
args1(1).Name = "RegionName"
args1(1).Value = "Section2"
args1(2).Name = "RegionCondition"
args1(2).Value = ""
args1(3).Name = "RegionHidden"
args1(3).Value = false
args1(4).Name = "RegionProtect"
args1(4).Value = false
args1(5).Name = "LinkName"
args1(5).Value = ""
args1(6).Name = "FilterName"
args1(6).Value = ""
args1(7).Name = "SubRegion"
args1(7).Value = ""

dispatcher.executeDispatch(document, ".uno:InsertSection", "", 0, args1())


end sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-04 18:31:13 +0200

Seen: 288 times

Last updated: Aug 04 '16