Now I'm using OpenOffice 4.1.13. But I will also interested in solution for Libre Office.
Thank you for the macro.
I have several questions:
- How to apply this macro? (macros are new for me in the office but I will investigate)
- How to set up Office to apply this macro automatically when the document is opened?
- Am I right that macro needs to be imported to each document file?
- How to get color code to set in macro based on office color panel picker in UI? Here (
https://ask.libreoffice.org/t/macro-hig ... iter/31655 ) I found that for this test macro can be recorded with pressing the button with needed color. But this is not convenient. Is it possible to specify color in this macro as RGB code? (It must be simpler to get -
viewtopic.php?t=71672 )
By now with the help of test macro recording I found out the following codes for orange color shades:
Orange color (more orange):
16737792
Orange 1 color (more yellow):
16763904
---
I extracted macro from "Orange highlight.odt" attachment:
Code: Select all
sub SetOrangeBackColor
if thiscomponent.ImplementationName = "SwXTextDocument" then
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(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BackColor"
args1(0).Value = 16763904
dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
end if
end sub