Is there a macro to SELECT whatever words are in Italics? Nothing else?

I’ve been trying to make one, and have been making a terrible mess. I’ve found several somewhat similar macros here, but nothing that will actually do the job — and my efforts to customize them have resulted either in the macro blowing, or in nothing happening.

This is for LibreOffice Writer, by the way.

Hmm - Edit -> Find & Replace and using button Format at the bottom and selecting Style “Italic” does not fit your purpose (after using button Find All all italics are selected and if you close the Find & Replace dialog they keep being selected)? Checking option Including Styles will also find and select italics-styled text

Addition: For me it also worked to record a macro while performing the Find & Replace action (using LIbreOffice 6.3.2.2)

Thanks, but I already tried that. YES, it WORKS — until I close the document and try to run that macro on another document, and THEN it doesn’t work. I’ve been tinkering around for days trying to get it to work. I’ve tried editing the macro, but it either crashes or freezes when I do that (my programming skills are not good enough).

I tried posting my code, but got stopped by the 1000 character limit.

TL;DR — I need to add some “args” that will set the FONT POSTURE in ATTRIBUTES and show the selection, but then switch the attribute OFF (without deselecting anything on my screen), to stop it interfering with other macros.

No matter how much I tweak the code, I cannot seem to get it to set the font posture ONLY for the document I’m working on.