Find and Replace Macro for Current Selection Only with Match Case

asked 2020-04-13 15:32:29 +0200

Aniruddha Mohod gravatar image

updated 2020-08-22 17:26:40 +0200

Alex Kemp gravatar image

I have created following macro. There are several search terms in the macro I have included just one for example. I wish that the macro should find a value only in the selected text. Similarly I wish that it should match case while finding the value. What changes I should do in the macro.

REM  *****  BASIC  *****

Sub KrutiDevToUnicode
  Dim oDescriptor  'The search descriptor
  Dim oFound       'The found range
  Dim oFoundAll    'The found range
  Dim n%           'General index variable
  oDescriptor = ThisComponent.createSearchDescriptor()

oDescriptor.SearchString = "yZ"
  oFoundAll = ThisComponent.findAll(oDescriptor)
  For n% = 0 to oFoundAll.getCount()-1
    oFound = oFoundAll.getByIndex(n%)
    oFound.setString("र्ल")
  Next
End Sub

[Edit - Opaque] Formatted code as preformatted text

edit retag flag offensive close merge delete