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

[µo°Ý] ÀÉ®×¾Þ§@ºÃ°Ý½Ð±Ð

[µo°Ý] ÀÉ®×¾Þ§@ºÃ°Ý½Ð±Ð

¦b¾Þ§@Àɮ׮ɤ@ª½­«ÂЦb²Ä¤@­ÓcsvÀɾާ@

µLªk¸õ¨ì¤U¤@­ÓcsvÀÉ®×

½Ð°Ý°ª¤â¤U­±ªºµ{§Ç¨ì©³­þ¸Ì¥X¤F°ÝÃD

«ç»ò¦n¹³°­¥´Àð¤@ª½¦b­ì¦a¶ ÁÂÁÂ

Sub Test()

On Error Resume Next

Application.DisplayAlerts = False

bPath = ThisWorkbook.Path

If Right(bPath, 1) <> "\" Then dirpath = bPath & "\"

csvName = Dir(dirpath & "*.csv")

Do While Len(csvName) > 0

    MsgBox csvName
   
    Workbooks.Open (dirpath & csvName)
    '
    'balabalabala
    '
    '
    ActiveWorkbook.Close savechanges:=False
            
    csvName = Dir
   
Loop

End Sub

On Error Resume Next®³±¼°»¿ù¬Ý¬Ý
°ò¥»¤W¦r¦ê³sµ²»yªk¤w¸g¿ù»~
csvName = Dir(dirpath & "*.csv")
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh
On Error Resume Next ¤wmark±¼
csvName = Dir(dirpath & "*.csv")  ¤¤ªº&¤w¥[¤W
°»¿ù¬O¥X²{¦b  csvName=dir   ³o¤@¦æ
«ç»ò¿ì©O

TOP

¦^´_ 3# huang40


    Sub Test()


Application.DisplayAlerts = False

dirPath = ThisWorkbook.Path & "\"

csvName = Dir(dirPath & "*.csv")

Do While csvName <> ""

    MsgBox csvName
   
    Workbooks.Open (dirPath & csvName)
    '
    'balabalabala
    '
    '
    ActiveWorkbook.Close savechanges:=False
            
    csvName = Dir
   
Loop

End Sub
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ huang40 ©ó 2010-9-6 11:30 ½s¿è

¦^´_ 4# Hsieh


³o¼Ë¬O°õ¦æOK

¦ý¤@¥¹¥[¤J¤¤¶¡balabalabalaªº³B²zµ{§Ç

  Workbooks.Open (dirPath & csvName)
    '
    'balabalabala
    '
    '
    ActiveWorkbook.Close savechanges:=False

csvName=dir ³o¦æ´NÁÙ¬O¥X²{¿ù»~°T®§

¦³¥i¯à¦]¬°¤¤¶¡³B²zªºµ{§Ç½X¥X°ÝÃD¾É­P¶Ü?

TOP

¦^´_ 5# huang40
¨º´NºCºC³v¦æ°»¿ù¡A¬Ý¿ù»~¥X¦b­þ?
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ huang40 ©ó 2010-9-6 20:06 ½s¿è

¸Õ¹LÁÙ¬O¥d¦bcsvName=dir³o¸Ì

¨Sªk¥i·Q¥u¦n¥Î³Ì²Âªº¤èªk

¥ý§âÀɦW¦C¥X¦A¤@­Ó¤@­Ó¶}±Ò ²×©ó·d©w

¥i¬O¹ï¬°¤°»ò·|¥d¦b csvName=dir ÁÙ¬O¤£ÁA

Á`¦³­Ó²z¥Ñ§a

Sub Test()
Application.DisplayAlerts = False
Sheets("MK").Activate
Columns("V").Clear
bPath = ThisWorkbook.Path
dirPath = ThisWorkbook.Path & "\"
csvName = Dir(dirPath & "*.csv")
n = 0
Do While csvName <> ""
    n = n + 1  
    Cells(n, 22) = csvName               
    csvName = Dir   
Loop
MsgBox n
For i = 1 To n
csvfile = Sheets(1).Cells(i, 22)
Workbooks.Open (dirPath & csvfile)    '
    '
    'balabalabala
    '
ActiveWorkbook.Close savechanges:=False
next i

TOP

³o»ò»¡§O¤HµLªkª¾¹D¿ù»~®ÉÅã¥Ü¤°»ò¤Î¥X¿ù®É¬Û¹ïÅܼƪº­È¬O§_¥¿½T¡A¥u¦³§A¦Û¤v¤@¦æ¦ærun®É¤~·|ª¾¹Dªº¡I

TOP

¥»©«³Ì«á¥Ñ huang40 ©ó 2010-9-7 11:39 ½s¿è

¨ä¹ê°ÝÃD«Ü³æ¯Â(©ÎªÌ§Ú¦Û¥H¬°«Ü³æ¯Â)

¦bTEST1¤£¯à°õ¦æªº¥Dµ{¦¡¥h«o¦bTEST2¥i¥H°õ¦æ

¨º°ÝÃD·|¬O¥X¦b­þ©O

Sub Test1()
Application.DisplayAlerts = False
dirPath = ThisWorkbook.Path & "\"
csvName = Dir(dirPath & "*.csv")
Do While csvName <> ""
    Workbooks.Open (dirPath & csvName)
    '
    '(¥Dµ{¦¡)
    '
    ActiveWorkbook.Close savechanges:=False            
    csvName = Dir
Loop

Sub Test2()
Application.DisplayAlerts = False
Sheets(1).Activate
Columns("V").Clear
dirPath = ThisWorkbook.Path & "\"
csvName = Dir(dirPath & "*.csv")
n = 0
Do While csvName <> ""
    n = n + 1  
    Cells(n, 22) = csvName               
    csvName = Dir   
Loop
MsgBox "ÀÉ®×¼Æ=" & n
For i = 1 To n
csvfile = Sheets(1).Cells(i, 22)
Workbooks.Open (dirPath & csvfile)   
    '
    '(¥Dµ{¦¡)
    '
ActiveWorkbook.Close savechanges:=False
next i
End Sub

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-9-7 18:02 ½s¿è

¦^´_ 9# huang40

­n¾Ç²ßVBA´N­n¾Ç·|°»¿ù
³v¦æ(F8)
¤@¦æ¤@¦æ¶]µ{¦¡¬ÝÅܼƭȪºÅܤƧä¥X¿ù»~
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¦a¤WºØ¤Fµæ¡A´N¤£©öªø¯ó¡F¤ß¤¤¦³µ½¡A´N¤£©ö¥Í´c¡C
ªð¦^¦Cªí ¤W¤@¥DÃD