ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

Word VBA «ü©w½d³ò¨ú¥N°ÝÃD

Word VBA «ü©w½d³ò¨ú¥N°ÝÃD

¦U¦ì°ª¤â¦n¡ã
§Ú¼g¤F¤@­ÓFunction ¨Ó°õ¦æ«ü©w½d³ò¡B«ü©w¤å¦r¡B«ü©w©³¦âªº¨ú¥N
¥i¬O°õ¦æ®Éµo²{¨Ã¨S¦³¿ìªk«ü¦b«ü©w½d³ò¤¤¶i¦æ¨ú¥N ¦Ó¬O·|Åܦ¨¾ã½g¨ú¥N
  1. Public Function myFun_findTxt2addShading( _
  2.                 str_findTxt As String, _
  3.                 range_myRange, _
  4.                 str_repTxt As String, _
  5.                 str_ShadingColor As String) As Boolean
  6.    
  7.     Dim boolean_checkFound As Boolean
  8.     boolean_checkFound = False

  9.     range_myRange.Select
  10.     With Selection
  11.         .Find.ClearFormatting
  12.         .Find.Replacement.ClearFormatting
  13.         .Find.Text = str_findTxt
  14.         .Find.Replacement.Text = str_repTxt
  15.         .Find.Forward = True
  16.         .Find.Replacement.Font.ColorIndex = str_RepFontColor
  17.         .Find.Wrap = wdFindStop
  18.         Do While .Find.Execute
  19.             Selection.Shading.Texture = wdTextureNone
  20.             Selection.Shading.ForegroundPatternColor = wdColorAutomatic
  21.             Selection.Shading.BackgroundPatternColor = str_ShadingColor
  22.             boolean_check = True
  23.         Loop
  24.         .Find.Format = False
  25.         .Find.MatchCase = False
  26.         .Find.MatchWholeWord = False
  27.         .Find.MatchByte = False
  28.         .Find.MatchWildcards = False
  29.         .Find.MatchSoundsLike = False
  30.         .Find.MatchAllWordForms = False

  31.     End With
  32.     findTxt_Shading = boolean_checkFound


  33.    
  34. End Function
  35. Sub test()
  36.    
  37.     a = myFun_findTxt2addShading("¤@", Selection.Range, "¤@", wdColorYellow)

  38. End Sub
½Æ»s¥N½X
¦³¤H¥i¥HÀ°¦£¸Ñ¨M¶Ü¡ã¡ã¡ã
ÁÂÁÂ

        ÀR«ä¦Û¦b : §Ñ¥\¤£§Ñ¹L¡A§Ñ«è¤£§Ñ®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD