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

¦p¦ó¥ÎVBA§ó§ï vba modular ªº¦WºÙ

¦p¦ó¥ÎVBA§ó§ï vba modular ªº¦WºÙ

¥»©«³Ì«á¥Ñ yen956 ©ó 2017-2-3 14:08 ½s¿è

¦p¦ó¥ÎVBA§ó§ï vba ¤¤ modular ªº¦WºÙ
¨Ò¦p:
sub test()
...
...
end sub
¦p¦ó§ï¦¨
sub test1()
...
...
end sub

¦^´_ 1# yen956
  1. Function TEST3()
  2. '§ó§ïªº¼Ò²Õ
  3. Set Obj = Application.VBE.ActiveVBProject.VBComponents("Module1")
  4. Row2 = Obj.CodeModule.ProcStart("TEST1", 0)
  5. RowCount = Obj.CodeModule.ProcCounts("TEST1", 0)
  6. Text = Split(Obj.CodeModule.s(Row2, RowCount), vbCrLf)
  7. Randomize
  8. Call Obj.CodeModule.Replace(Row2, "Function TEST2()")
  9.       
  10. End Function
  11. Function TEST1()
  12. '³Q§ó§ïªº¼Ò²Õ
  13. A = B

  14. End Function
½Æ»s¥N½X
PKKO

TOP

¦^´_ 2# PKKO
ÁÂÁ§ֳt¦^ÂÐ, ÁÂÁÂ,
¤£¹L«Ü©êºp!¬Ý¤£á˦p¦ó´ú¸Õ,
¸ÕµÛ±q test5 ¶}©l´ú¸Õ(step by step),
µ²ªG¨ì¬õ¦â®Ø®Ø¨º¦C, §Y¥X²{¤U¦C°T®§, ¬°¦ó?
ps:­ìpo¤å¼ÐÃD¿ù»~, À³§ï¬°
¡y¦p¦ó¥ÎVBA§ó§ï vba ªº macro ¦WºÙ¡z¤~¹ï

TOP

¥»©«³Ì«á¥Ñ yen956 ©ó 2017-2-6 10:01 ½s¿è

¦^´_ 3# yen956
¤j¤j±z­Ì¦n:
¦b§V¤Ogoogle«á, µo²{­ì¨Ó¬O¡£¤Þ¥Î¶µ¥Ø¡¤¤Î¡£³]©w¥¨¶°¦w¥þ©Ê¡¤ªº°ÝÃD, §Y
1. ³]©w¤Þ¥Î¶µ¥Ø: Microsoft Visual Basic For Applications Extensibility 5.3
2. ¥¨¶°¦w¥þ©Ê:¤Ä¿ï«H¥ô Visual Basic
¦ý, ¤]¥u·|¦h°õ¦æ¤@¦C, ­ì¥ý°±¯d¦b¬õ¦â®Ø¨º¦C,
²{¦b°±¯d¦bÂŦâ®Ø®Ø¨º¦C, §Y·|¥X²{³o­Ó°T®§, Why?

TOP

¥»©«³Ì«á¥Ñ PKKO ©ó 2017-2-6 12:30 ½s¿è

¬¡­¶Ã¯1.rar (10.64 KB) ¦^´_ 4# yen956

¤£¥Î¤Þ¥Î¶µ¥Ø
¤U¸üÀɮת½±µ¶}±ÒVBEµe­±°õ¦æ²Ä¤@­Ó¥¨¶°§Y¥i§ó§ï²Ä¤G­Ó¥¨¶°ªº¼Ò²Õ¦WºÙ

¼Ò²Õ¤£¥i¤WÂê

­Y¦³¤WÂê¼Ò²Õ,·|»Ý­n§ó¦hCODE
PKKO

TOP

¦^´_ 5# PKKO
ªGµM¤£¥²¤Þ¥Î!! ¥Btest1()¥i§ï¬°test2()
ÁÂÁ¥Τ߫ü¥¿!!ÁÂÁÂ!!

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD