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

Activate»POpenªº®t§O¸òWindowsªº©w¸q

Activate»POpenªº®t§O¸òWindowsªº©w¸q

½Ð°Ý¦U¦ì¤j¤j¡A¦³¨â­Ó°ÝÃD·Q½Ð±Ð¡A

°ÝÃD¤@

    ¶}±Ò¬¡­¶Ã¯ªº®É­Ô¡Aµ{¦¡»y¨¥¤À§O¬°Windows("»s§@¼t°Ó©ú²Óªí.xlsm").Activate ¸òWindows("»s§@¼t°Ó©ú²Óªí.xlsm").Open

     ªº®t²§?

°ÝÃD¤G

    Workbooks.Open "C:\Users\Andy\Desktop\VBAµ{¦¡½X¬ö¿ý¥»\»s§@¼t°Ó©ú²Óªí\Á`¤½¥q¸ê®Æ.xlsm"   

    ¸ò

    Windows("»s§@¼t°Ó©ú²Óªí.xlsm").Activate

   «áªÌ¡A¡A§Úªº²z¸Ñ¬O»¡¥u­n³o¥x¹q¸£¦³¦¹¬¡­¶Ã¯¦WºÙ(»s§@¼t°Ó©ú²Óªí)¡A«K¶}±Ò§@·~¡C

   ÀuÂI¤W¡A¥iŪ©Ê¤ñ«eªÌ°ª¡C¨º¦Ü©ó«eªÌ¡A¬O¤°»ò±¡ªp¤U·|¥Î¨ì©O?



¨â­Ó°ÝÃD¡A·Q½Ð±Ð¤j¤j¡A·Q¤F¨â­Ó§«ô¡AÁÙ¦b­W´o¦p¦ó±qB¬¡­¶Ã¯½Æ»s¨ìA¬¡­¶Ã¯¡C¡C¡C¡CÃø¹L¡C..

½Ð°Ý¦U¦ì¤j¤j¡A¦³¨â­Ó°ÝÃD·Q½Ð±Ð¡A

°ÝÃD¤@

Windows.Activate »P Workbooks.Open ªº®t²§?

¾Ç¨ì¦Ñ¦º µoªí©ó 2016-3-27 12:27


­è­è§Ú¸Õ°µ«á,±o¥Xµ²½×¦p¤U: (¸Õ°µÀô¹Ò: Excel 2000ª©¥»)

­º¥ý

Windows("»s§@¼t°Ó©ú²Óªí.xls").Activate

­Y "»s§@¼t°Ó©ú²Óªí.xls" ¬¡­¶Ã¯©|¥¼Åª¤J°O¾ÐÅ餤®É,
·|¥X²{¿ù»~°T®§ :

  °}¦C¯Á¤Þ¶W¥X½d³ò

¦]¬°¦b¤w¶}±Òªº ¬¡­¶Ã¯ª«¥ó¸s²Õ ¤¤§ä¤£¨ì¦³¦¹¦WºÙªº¬¡­¶Ã¯. (¥i¦b§Y®É¹Bºâµøµ¡¥Î for each a in Workbooks:debug.Print a.name:next ¨ú±o°O¾ÐÅé²{¦³¬¡­¶Ã¯¦WºÙ¦Cªí)


µM¦Ó

Workbooks.Open "C:\Users\Andy\Desktop\VBAµ{¦¡½X¬ö¿ý¥»\»s§@¼t°Ó©ú²Óªí\Á`¤½¥q¸ê®Æ.xlsm"  

«h¬O¨ì «ü©wªº¥Ø¿ý(­Y°Ñ¼Æ¦³§t¸ô®|) ©Î¬O ¥Ø«eªº¥Ø¿ý(¥i¥Î Curdir ¨ú±o) §ä¨ì¸ÓÀɮ׶}±Ò¨Ã³]¬° °µ°Ê¤¤,

¦ý­Y¦¹Àɮפw¦s¦b°O¾ÐÅ餤«h·|¸ß°Ý¬O§_­nÃö³¬¦A­«¶}¸ÓÀÉ®×.


·N§Y Activate ¬O¦b "°O¾ÐÅ餤" §ä¨ìª«¥ó(¹ï¶H¤£­­¬¡­¶Ã¯)¨Ã³]¬° °µ°Ê¤¤,

¦Ó Workbooks.Open ¬O¦b "µwºÐ¤¤" §ä¨ìÀÉ®×(¥u¯à¬OExcelÀÉ®×)¨Ã³]¬° °µ°Ê¤¤,

©Ò¥H­YÀÉ®×¥¼¶}«hÀ³¥Î Open ¶}±Ò, §_«hÀ³¥Î Activate ³]¬° °µ°Ê¤¤.


¦p¦ó±qB¬¡­¶Ã¯½Æ»s¨ìA¬¡­¶Ã¯

1. ¥ý¶}±Ò¤@­Ó¬¡­¶Ã¯,¦A±q¸Ó¬¡­¶Ã¯¤¤¥Î Workbooks.Open ¶}±Ò¥t¤@­Ó¬¡­¶Ã¯.(­Y­Ó§O¤â°Ê¶}±Ò¦³¥i¯à¤¬¬Û¬Ý¤£¨ì)

2. °õ¦æ¤U¦C«ü¥O :

Workbooks("¨Ó·½ÀÉ®×.xls").Sheets("­n«þ¨©ªº¤u§@ªí").Copy Before:=Workbooks("¥ØªºÀÉ®×.xls").Sheets(Sheets.Count)

TOP

¦^´_ 1# ¾Ç¨ì¦Ñ¦º
²³æªº»¡Open¬O±qÀx¦s¸Ë¸m¤¤¶}±Ò¬¡­¶Ã¯¡AActivate«h¬O±q¤w¶}±Òªº¬¡­¶Ã¯(¦Ü¤Ö2­Ó©Î¥H¤W)¤¤¿ï¾Ü­þ­Ó¬¡­¶Ã¯¬°§@¥Î¤¤¡C
¦¨¬°§@¥Î¤¤ªº¬¡­¶Ã¯«á¡A±µ¤U¨ÓªºÄÝ©Ê¡Bª«¥ó...µ¥¾Þ§@¡A¥u°w¹ï§@¥Î¤¤ªº¬¡­¶Ã¯¡C
¥t¥~(°ÝÃD¤@)¸Ì­±¨Ã¨S¦³Windows("»s§@¼t°Ó©ú²Óªí.xlsm").Open³oºØ»yªk¡C
¬°¦ó­n­Ó¤Hñ¦W

TOP

        ÀR«ä¦Û¦b : ¤â¤ß¦V¤U¬O§U¤H¡A¤â¤ß¦V¤W¬O¨D¤H¡F§U¤H§Ö¼Ö¡A¨D¤Hµh­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD