I have some experience in Microsoft Excel VBA but very new in OOBase.
I have recorded some macros in calc by dividing a text document into 5 pages, inserting some cells to the right to make indents. I then combine the 5 pages back to 1 page again in the 6 th page.
Next I copy this page 6 from the calc worksheet, open a blank writer doc and paste special into the writer page in rtf formatted page.
Then I select the whole page and format the page with number listing with levels.
Next I use the number of # to give the indents.
The calc macros work in the calc worksheet. The writer macros work in the writer doc.
Question: How to run all the calc macros and the writer macros in a combined macro in the calc worksheet?
I tried it many times but it macro broke due to unexpected errors.
The program broke down at this line of the code:(Within the sub RunWriterSubs)
Code: Select all
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:BulletsAndNumberingDialog", "", 0, Array())
Code: Select all
sub Integrating_calc8_wrter8_macros
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ---Step 1 -------------------------------------------------------------
run_calc_subs
rem ----Step 2-------------------------------------------------------------
RunWriterSubs
end sub
sub From_table_to_list
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = StarDesktop.CurrentComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Count"
args2(0).Value = 2
args2(1).Name = "Select"
args2(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoUp", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectTable", "", 0, Array())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Delimiter"
args3(0).Value = "#"
dispatcher.executeDispatch(document, ".uno:ConvertTableToText", "", 0, args3())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:ConvertTableToText", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:BulletsAndNumberingDialog", "", 0, Array())
end sub