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

[Âà¶K] VBA-Â^¨ú¥]§tÃöÁä¦rªº©Ò¦³¬q¸¨¥á¨ì·s¤å¥ó¤¤

[Âà¶K] VBA-Â^¨ú¥]§tÃöÁä¦rªº©Ò¦³¬q¸¨¥á¨ì·s¤å¥ó¤¤

­ìµoªíªÌ¡Gleonchou (2005-04-30)

[°ÝÃD] ¦Û°ÊÂ^¨ú¡B¥t¦s¦³Ãö¬Y­Ó«ü©wÃöÁä¦rªº©Ò¦³¬q¸¨, VBA«ç»ò¼g?
³o­Ó°ÝÃD¥O§Ú·Q¨ì¤FUnix/Linuxªº grep «ü¥O~
¦bLinux¥i¥H¥Îµuµu¤@¦æ«ü¥O¸Ñ¨Mªº¨Æ,¦bWindows³ºµM­n°Ê¥Î¨ìµ{¦¡~ ¯u¬Oªº... ^^|||
(¦pªG¯u¦³³o¼Ëªº¤º«Ø«ü¥O©Î¥\¯à, ·Ð½Ð«ü¾É, Thanks!!)
  1. Sub ªF§ä¦è§ä( )
  2. ¡@Set myRange = ActiveDocument.Content
  3. ¡@§äÔ£ = InputBox("§äÔ£?")
  4. ¡@§ä¨ì = myRange.Find.Execute(§äÔ£)
  5. ¡@Do While §ä¨ì
  6. ¡@¡@¥´¥] = ¥´¥] & myRange.Paragraphs(1)
  7. ¡@¡@§ä¨ì = myRange.Find.Execute(§äÔ£)
  8. ¡@Loop
  9. ¡@If IsEmpty(¥´¥]) Then MsgBox "§äµL!": Exit Sub
  10. ¡@Documents.Add: Selection = ¥´¥]
  11. End Sub
½Æ»s¥N½X
³o­Ó¥¨¶°¬O¥Î [´M§ä] ªº¤è¦¡¡A¦¬¶°©Ò¦³¥]§tÃöÁä¦rªº¬q¸¨¡AµM«á¤@¦¸¥á¨ì·s¤å¥ó¤¤¡C
¥Ñ©ó Word2002 ¦³ [¦h­«¿ï¨ú] ªº¥\¯à, ©Î³\¥i¥H¤@¦¸³B²z, ¤£¶·¥Î¨ì°j°é¤]»¡¤£©w~~
PS. grep«ü¥OÀ³¸Ó¬O¥u¯à³B²z¯Â¤å¦rÀÉ®×, ·Q·Q¤Sı±o®³³o­Ó¨Ó¸ò Word / VBA ¤ñ¸û, ¦ü¥G¦³¤í¤½¥­.. :p

--------------------------------------
¦³¸Õ¹L¤W­±¥¨¶°ªº¤H¥i¯à·|µo²{, ­Y¬O¦P¤@¬qªºkeyword¦³¤@­Ó¥H¤W, ·|³Q­«½Æ³B²z;¤]´N¬O¦P¤@¬q¥i¯à·|³Q­«½ÆÂ^¨ú¦Ü·s¤å¥ó.
­nÁקK³oºØ±¡§Î, ¥i¦b Do...Loop ¶¡´¡¤J¤@¦æ:
myRange.EndOf wdParagraph
  1. Sub ªF§ä¦è§ä( )
  2. ¡@Set myRange = ActiveDocument.Content
  3. ¡@§äÔ£ = InputBox("§äÔ£?")
  4. ¡@§ä¨ì = myRange.Find.Execute(§äÔ£)
  5. ¡@Do While §ä¨ì
  6. ¡@¡@¥´¥] = ¥´¥] & myRange.Paragraphs(1)
  7. ¡@¡@myRange.EndOf wdParagraph
  8. ¡@¡@§ä¨ì = myRange.Find.Execute(§äÔ£)
  9. ¡@Loop
  10. ¡@If IsEmpty(¥´¥]) Then MsgBox "§äµL!": Exit Sub
  11. ¡@Documents.Add: Selection = ¥´¥]
  12. End Sub
½Æ»s¥N½X
myRange.EndOf wdParagraph ªº·N«ä¬O§â myRange §ï³]©w¦Ü¸Ó¬q¸¨ªºµ²§À,¤]´N¬Oª½±µ±q¤U¤@¬qÄ~Äò´M§ä,§Y¥iÁקK­«½Æ³B²z¦P¤@¬qªºkeyword.
wdParagraph ¬O EndOF «ü¥O(¤èªk)ªº°Ñ¼Æ,«ü¥H ¬q¸¨ ¬°³æ¦ì. ¦¹°Ñ¼Æ¥i«ü©w¨ä¥L³æ¦ì, ¦p wdCharacter (¦r¤¸)¡BwdWord (³æ¦r)...µ¥µ¥, ¸Ô²Ó¥Îªk½Ð¨£ Word VBA »²§U»¡©ú~
°¶Ôйq¤l®Ñ,Åwªï§K¶O¤U¸ü°Ñ¦Ò
http://www.twbts.com/ebook/?subject=office
http://www.twbts.com/ebook/?subject=soft
°¶ÔÐÂîѮw---https://www.facebook.com/groups/669579416484096/
¦³¤@®a¬a¥J©±---https://www.facebook.com/sadodona

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD