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

VBA ¦³Ãö¸ô®|ªº°ÝÃD(ºâ¤w¸Ñ¨M)

VBA ¦³Ãö¸ô®|ªº°ÝÃD(ºâ¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-3 09:34 ½s¿è

file_path_get = Application.GetOpenFilename("EXCEÀÉ(*.XLS),*xls") <<<¥Î¥ª¤èªºµ{¦¡½X ¶}ÂÂÀÉ«á ¨ú±o §¹¾ã¸ô®|

C:\Users\user\Desktop\jEveAssets\´ú¸Õ¥Î2.xls <<§¹¾ã¸ô®|/ÀɦW ¦p¥ª

¦ý©_©Çªº¬O §Ú§â¥¦ ¦s¦bP1«á  ¦sEXCEL >Ãö±¼> ­«¶}..
Range("p1").Value = file_path_get '¨ú±o§¹¾ã¸ô®|

¯«©_ªº¨Æµo¥Í¤F ¥L·|¦Û°ÊÅܦ¨
C:\Users\user\Documents\´ú¸Õ¥Î1.xls   <<<¤£ºÞ§Ú§âÀɮשñ¦b¨º¤@¼Ñ ¦b¨º¤@¥Ø¿ý¤U  ³£·|³Q¦Û°Ê§ï¸ô®|¦WºÙ(ÀɮצW¤£·|§ï) ½Ð°Ý«ç·|³o¼Ë©O?
¥D­n¬O·Q§Ë¤@­Ó¤â°Ê¿ï¨úÂÂÀɨÃŪ¨ú¥¦ªº§¹¾ã¸ô®| ¦A§Q¥Î¸ô®|°µ¨ä¥¦¨Ï¥Î

¥t¥~ ¤£ª¾¦³¨S¦³¤°»ò¤èªk¥i¥H¦b¤£¶}啓¥Ø¼ÐÀÉ.XLS±¡ªp¤U Ū¨ú¨ì¥¦ªº¤u§@ªí(¤u§@ªí¥u¦³¤@­¶)?
¥Ø«e¬O±Ä¥Î
¶Ç¤J°Ñ¼Æ«á>(Ū¨úP1ªº­È(§¹¾ã¸ô®|)>¥´¶}¥¦>¨ú±o¥¦ªº¤u§@ªí¦WºÙ>¦AÃö±¼«á >¦^¶Ç¤u§@ªí¦WºÙ
Sub get_sheets_name(sheet_name, close_name)
    file_path= Range("p1").Value
    Worksheets("¤ÀªRªí").Activate
    Workbooks.Open Filename:=file_path
    sheet_name = ActiveSheet.Name
    Workbooks(close_name).Close
End Sub





PS:§Ú¬O¥ÎW7 ¤ÎOFFICE2003

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-4-2 12:21 ½s¿è

¦^´_ 1# icestormer
Application.GetOpenFilename ¬O¨S¦³¶}±ÒÀɮתº,¦p¦³¿ï¨úÀÉ®×·|¶Ç¦^³oÀɮתº§¹¾ã¸ô®|¦WºÙ
¸Õ¸Õ¬Ý¬O³o¼Ëªº¶Ü?
  1. Option Explicit
  2. Sub Ex()
  3.     Dim file_path_get As String, Wo As Workbook
  4.     file_path_get = Application.GetOpenFilename("EXCEÀÉ(*.XLS),*xls")
  5.     Set Wo = Workbooks.Open(file_path_get)                               '³]©wÅܼƬ° ¶}±Ò¿ï¨úªºÀÉ®×
  6.     WorkBooks("¤ÀªRªí").Sheets(1).[a1] = Wo.Sheets(1).Name   '¨ú±o²Ä¤@­Ó¤u§@ªí¦WºÙ
  7.     Wo.Close 0                                                                                       'Ãö³¬ ¿ï¨úªºÀÉ®× ¤£¦sÀÉ
  8. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-4-2 11:40 ½s¿è

¦^´_ 2# GBKEE


   §A¦n
°õ¦æ¤U¥h«á¥X²{³o­Ó¿ù»~©O ¦p¤U¹Ï(°õ¦æ¶¥¬q¿ù»~ 9 ,°}¦C¯Á¤Þ¶W¥X½d³ò
http://imgur.com/xc6Gz
¬O¿ù¦b³o¦æ Worksheets("¤ÀªRªí").Sheets(1).[p1] = Wo.Sheets(1).Name   '¨ú±o²Ä¤@­Ó¤u§@ªí¦WºÙ §Ú¬O§â§Aªºµ{¦¡½XCOPY«á§¹¾ã¶K¤W¥h°õ¦æªº ¤£ª¾¤èªk¬O§_¦³¿ù?


¥t¥~
¯«©_ªº¨Æµo¥Í¤F ¥L·|¦Û°ÊÅܦ¨
C:\Users\user\Documents\´ú¸Õ¥Î1.xls   <<<¤£ºÞ§Ú§âÀɮשñ¦b¨º¤@¼Ñ ¦b¨º¤@¥Ø¿ý¤U  ³£·|³Q¦Û°Ê§ï¸ô®|¦WºÙ(ÀɮצW¤£·|§ï) ½Ð°Ý«ç·|³o¼Ë©O?


¼È®É§ä¨ì¥t¤@­Ó¤èªk³B²z ¦pªG§Ú¼g¤Jªº¸ô®|¦WºÙ¬O©ñ¦b[A1]¤º ³o®É­n¥t¥~¼g¤@­Ó §â[a1].copy ¨ì[a2] µM«á ¥¨¶°´N±Ä¥Î[A2]ªº´N¥i¦æ¤F

¦]¥u­n¦sÀÉ«á [A1]ªº¸ô®|¦WºÙ·|³Q¦Û°Ê§ïÅܦý [A2]ªºÓý¤£·|.. ¤£ª¾³o¨ì©³¬O«ç¤@¦^¨Æ..

TOP

¦^´_ 4# GBKEE


   ¦³ ¦ý¤@¼Ë¥X²{¦P¤@­Ó°ÝÃD

TOP

¦^´_ 4# icestormer
Worksheets("¤ÀªRªí").Sheets(1) ³o»yªk¿ù»~      ¤w§ó¥¿ 2# ªºµ{¦¡½X
¯«©_ªº¨Æµo¥Í¤F    ¤£ºÞ§Ú§âÀɮשñ¦b¨º¤@¼Ñ ¦b¨º¤@¥Ø¿ý¤U
¤£¬O¯«©_ªº    ¬O GetOpenFilename ·|¶Ç¦^¿ï¨úÀɮתº§¹¾ã¸ô®|¦WºÙ
[A1]=file_path    ·íµM·|¦Û°Ê§ï¸ô®|¦WºÙ
  1. Sub Ex()
  2.     Dim file_path_get As String
  3.      file_path = Application.GetOpenFilename("EXCEÀÉ(*.XLS),*xls")
  4.     MsgBox file_path
  5. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# GBKEE


     §Úªº·N«ä¬O

¬O¯«©_ªº    ¬O GetOpenFilename ·|¶Ç¦^¿ï¨úÀɮתº§¹¾ã¸ô®|¦WºÙ
§Ú¥Î ³o­Ó«ü¥O ¨ú±o¤@­ÓÀɮתº§¹¾ã¸ô®|
[¨Ò¦pA1] ¬OC:\Users\user\Desktop\³ÌªñÀx¦sÀÉ\´ú¸Õ¥Î12.xls ¦ý¥u­n§Ú¤@¦sÀÉ>Ãö±¼EXCEL>­«¶}
´N·|Åܦ¨C:\Users\user\Documents\´ú¸Õ¥Î1.xls

¤£ºÞ§ÚÀɮ׬O©ñ¦b¨º¸Ì ÀɦW¬°¦ó ³£·|³Q¦Û°Ê§ïÅÜ ¥u¦³ÀɮצWºÙ-´ú¸Õ¥Î1.xls¤£ÅÜ

TOP

¦^´_ 6# icestormer
¶Ç¤WÀɮ׬ݬÝ

TOP

¦^´_ 7# GBKEE


  ·PÁ§Aªá®É¶¡¦^´_§Ú

¤£ª¾«ç¤F ­è¤S­«§Ë¤F¤@¤U ¤S¥i¦æ¤F

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤H¤£©È¿ù¡A´N©È¤£§ï¹L¡A§ï¹L¨Ã¤£Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD