Find and replace Macro [closed]

asked 2014-03-14 15:28:59 +0200

luba101 gravatar image

Hello,

I've recorded a Macro that automatically highlights certain words when I save the document. Here is the macro code:

sub sentandrcvd 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(18) as new com.sun.star.beans.PropertyValue args1(0).Name = "SearchItem.StyleFamily" args1(0).Value = 2 args1(1).Name = "SearchItem.CellType" args1(1).Value = 0 args1(2).Name = "SearchItem.RowDirection" args1(2).Value = true args1(3).Name = "SearchItem.AllTables" args1(3).Value = false args1(4).Name = "SearchItem.Backward" args1(4).Value = false args1(5).Name = "SearchItem.Pattern" args1(5).Value = false args1(6).Name = "SearchItem.Content" args1(6).Value = false args1(7).Name = "SearchItem.AsianOptions" args1(7).Value = false args1(8).Name = "SearchItem.AlgorithmType" args1(8).Value = 0 args1(9).Name = "SearchItem.SearchFlags" args1(9).Value = 65552 args1(10).Name = "SearchItem.SearchString" args1(10).Value = "RCVD" args1(11).Name = "SearchItem.ReplaceString" args1(11).Value = "" args1(12).Name = "SearchItem.Locale" args1(12).Value = 255 args1(13).Name = "SearchItem.ChangedChars" args1(13).Value = 2 args1(14).Name = "SearchItem.DeletedChars" args1(14).Value = 2 args1(15).Name = "SearchItem.InsertedChars" args1(15).Value = 2 args1(16).Name = "SearchItem.TransliterateFlags" args1(16).Value = 1280 args1(17).Name = "SearchItem.Command" args1(17).Value = 1 args1(18).Name = "Quiet" args1(18).Value = true

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

rem ---------------------------------------------------------------------- dim args2(0) as new com.sun.star.beans.PropertyValue args2(0).Name = "BackColor" args2(0).Value = 65280

dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args2())

rem ---------------------------------------------------------------------- dim args3(18) as new com.sun.star.beans.PropertyValue args3(0).Name = "SearchItem.StyleFamily" args3(0).Value = 2 args3(1).Name = "SearchItem.CellType" args3(1).Value = 0 args3(2).Name = "SearchItem.RowDirection" args3(2).Value = true args3(3).Name = "SearchItem.AllTables" args3(3).Value = false args3(4).Name = "SearchItem.Backward" args3(4).Value = false args3(5).Name = "SearchItem.Pattern" args3(5).Value = false args3(6).Name = "SearchItem.Content" args3(6).Value = false args3(7).Name = "SearchItem.AsianOptions" args3(7).Value = false args3(8).Name = "SearchItem.AlgorithmType" args3(8).Value = 0 args3(9).Name = "SearchItem.SearchFlags" args3(9).Value = 65552 args3(10).Name = "SearchItem.SearchString" args3(10).Value = "EMLD" args3(11).Name = "SearchItem.ReplaceString" args3(11).Value = "" args3(12).Name = "SearchItem.Locale" args3(12).Value = 255 args3(13).Name = "SearchItem.ChangedChars" args3(13 ... (more)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2016-02-20 07:37:34.312993