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

[µo°Ý] ¦p¦ó¨ú±o¤G¬q¤¤¶¡ªº¦r¦ê (WORD VBA )

[µo°Ý] ¦p¦ó¨ú±o¤G¬q¤¤¶¡ªº¦r¦ê (WORD VBA )

¤u§@¤Wªº»Ý¨D¤ÎVBAÔò³¾ ¡A½Ð°Ý°²³]¤@½g word  ¤º®e¦p¤U:

----------------word  begin---------------------
µLÃöºò­n1
µLÃöºò­n2
          <©ïÀY>
§Ú­nªº¤º®e1
§Ú­nªº¤º®e2
§Ú­nªº¤º®e3
§Ú­nªº¤º®e4
   <µ²§À>  
       §ÚÁÙ¦³«Ü¦h1
        §ÚÁÙ¦³«Ü¦h2
         §ÚÁÙ¦³«Ü¦h3
----------------word  end-----------------------

°ÝÃD:
½Ð°Ý¦U¦ì¥ý¶i¡A§Ú­n¨ú±o <©ïÀY> ¨ì <µ²§À>ªº¤º®e (¤£¥]§t©ïÀY¤Î µ²§À)  ¦p¤U:

§Ú­nªº¤º®e1
§Ú­nªº¤º®e2
§Ú­nªº¤º®e3
§Ú­nªº¤º®e4

§Úªº·Qªk¬O¥Î range.find ¤À§O§ä¥X <©ïÀY> ©M <µ²§À> ªº¦æ¸¹¡A¦A±q  <©ïÀY>+1  §ä¨ì <µ²§À>-1 ªº¸ê®Æ¡A¦ýVBA¥\¤O¤Ó®z¡A¥i¥H½Ð¦U¦ì¤j¯« À°¦£¤@¤U¡AÁÂÁ¡C

D2:D6{=INDEX(B:B,SMALL(IF((ROW(B$3:B$14)>MATCH(,0/FIND("©ïÀY",B$3:B$14),)+2)*(ROW(B$3:B$14)<MATCH(,0/FIND("µ²§À",B$3:B$14),)+2),ROW(B$3:B$14),4^8),ROW(A1)))&""

E2:E6{=IF(MATCH("          <©ïÀY>",B:B,)+ROW(A1)>=MATCH("   <µ²§À>  ",B:B,),"",INDEX(B:B,MATCH("          <©ïÀY>",B:B,)+ROW(A1)))

F2:F6{=IF(MATCH(,0/FIND("©ïÀY",B$3:B$14),)+ROW(A1)>=MATCH(,0/FIND("µ²§À",B$3:B$14),),"",INDEX(B:B,MATCH(,0/FIND("©ïÀY",B$3:B$14),)+ROW(A1)+2))

5208.png (22.69 KB)

5208.png

google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

ÁÂÁ hcm19522 ¥ý¶iªº¦^ÂÐ : ) , ¥u¬O§Ú­nªº¬O office word ªº¸Ñªk¡A¨þ¨þ!!!:)

TOP

SELECTION.Find.Execute FindText:="<©ïÀY>"
   SELECTION.EndKey unit:=wdLine
  SELECTION.HomeKey unit:=wdStory, Extend:=wdExtend
a=selection.range.characters.count
SELECTION.homeKey
   SELECTION.Find.Execute FindText:="<µ²§À>"
   SELECTION.homeKey unit:=wdLine
  SELECTION.HomeKey unit:=wdStory, Extend:=wdExtend
b=selection.range.characters.count
Set myRange = ActiveDocument.Range(Start:=a, End:=b)
msgbox  myRange

TOP

        ÀR«ä¦Û¦b : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD