Macro is now broken

I am not sure what broke the macro. My machine recently updated to Windows 10 Creator Edition. I also updated LO to version

Here’s the macro that used to work:

sub Remove_WT_Unicode_Junk
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("")

rem msgbox "running Remove_WT_Unicode_Junk"

rem Replace '+' for scripture references
dim args1(18) as new
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 = 65536
args1(10).Name = "SearchItem.SearchString"
args1(10).Value = "+"
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 = 3
args1(18).Name = "Quiet"
args1(18).Value = true

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

end sub

How do I get this to work?

BTW: I added { msgbox “running Remove_WT_Unicode_Junk” } to verify that the macro actually runs, and it does. It just doesn’t do anything at all. For example in the code above, a “+” sign should be replaced with nothing. Nothing happens, those signs remain, and text is unchanged.

I also found out that when I use a different template the macro works as expected, even with identical text that should be replaced.


Its a record of find&Replace, record the action again and compare both macros.

My guess: there is some different in line args1(17).Value = ???

Many thanks, karolus. Looks like I found a bug that I can’t reproduce. When I open the document where it wasn’t working before, it does work now. I have closed and re-opened Writer in the meantime.