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

[µo°Ý] FileDialog(msoFileDialogFilePicker) ¶}±Ò«ü©wÀÉ®×

[µo°Ý] FileDialog(msoFileDialogFilePicker) ¶}±Ò«ü©wÀÉ®×

¦U¦ì¤j¤j§A¦n

¥H¤Uªºµ{¦¡¬O¦bºô¤W§ä¨ìªº, ¥Î³~¬O¦b¶}±Ò¤@­Óexcel Àɮפ§«á°õ¦æ¥H¤Uµ{¦¡, ¥i¥H¼u¥X¤@­Ó¿ï®Ø¬[¥i¥H¦Û¦æ¥ô·N¿ï¨ú¬Y¤@­Óexcel Àɮרýƻs©Ò¦³¤u§@ªí¨ì²{¦b¥´¶}ªºexcel file,

·í¿ï¨úÀɮ׫á´N¤£¯à½Æ»s¤u§@ªí, ½ÐÀ°¦£¬Ý¬Ý«üÂIµ{¦¡°ÝÃD¦b¨º¨½, ÁÂÁÂ





Sub test()
Dim FName As String, FPath As String
Dim sheet As Worksheet
Dim FDialog As FileDialog

Application.ScreenUpdating = False


Set FDialog = Application.FileDialog(msoFileDialogFilePicker)

If FDialog.Show = -1 Then
    FPath = FDialog.SelectedItems(1)
End If


'FName = Dir(FPath & "\*.xlsx*")

Do While FPath <> ""
    Workbooks.Open Filename:=FPath, ReadOnly:=True
    For Each sheet In ActiveWorkbook.Sheets
        sheet.Copy After:=ThisWorkbook.Sheets(1)
    Next sheet
Workbooks(FPath).Close
Loop

Application.ScreenUpdating = True


End Sub

¦^´_ 1# mdr0465

½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁ¡C

Sub test()
Dim FName As String, FPath As String
Dim sheet As Worksheet
Dim FDialog As FileDialog

Application.ScreenUpdating = False
Application.DisplayAlerts = False ' Ãö³¬Äµ§i°T®§
Set FDialog = Application.FileDialog(msoFileDialogFilePicker)
If FDialog.Show = -1 Then
     FPath = FDialog.SelectedItems(1)
End If

Do While FPath <> ""
    Set WB = Workbooks.Open(FPath)
    For Each sheet In ActiveWorkbook.Sheets
        sheet.Copy After:=ThisWorkbook.Sheets(1)
    Next sheet
    WB.Close
Loop

Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub

TOP

¦^´_ 2# samwang


    samwangÁÂÁ§Aªº¦^ÂÐ,
¦ý·í§Ú¦b¤@­Ó¤å¥ó§¨¨½¦³´X­ÓexcelÀÉ,§Ú¿ï¨ú¤F¬Y¤@­ÓÀɮתº®É­Ô,¥¦¹B¦æµ{¦¡®É,·|¤£°±½Æ»s³Q¿ï¨úªºÀɮר½ªº¤u§@ªí¨S¦³°±¤î,½Ð°ÝÀ³«ç¼Ë§ï©O?
 
ÁÂÁÂ

TOP

¦^´_ 3# mdr0465

½Ð¦A´ú¸Õ¬Ý¬Ý¡AÁÂÁ¡C

Sub test2()
Dim FName As String, FPath As String
Dim sheet As Worksheet
Dim FDialog As FileDialog

Application.ScreenUpdating = False
Application.DisplayAlerts = False ' Ãö³¬Äµ§i°T®§
Set FDialog = Application.FileDialog(msoFileDialogFilePicker)
If FDialog.Show = -1 Then
     FPath = FDialog.SelectedItems(1)
End If

For x = 1 To FDialog.SelectedItems.Count

    Set WB = Workbooks.Open(FPath)
    For Each sheet In ActiveWorkbook.Sheets
        sheet.Copy After:=ThisWorkbook.Sheets(1)
    Next sheet
    WB.Close
Next

Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

TOP

¦^´_ 3# mdr0465


¤£¦n·N«ä¡A4¼Óªºµ{¦¡¦³°ÝÃD¡A¥H¦¹¬°¥D(¥i¥H¦P®É½Æ¿ï¾Ü¦h­Óexcel)¡AÁÂÁÂ

Sub test()
Dim FName As String, FPath As String
Dim sheet As Worksheet
Dim FDialog As FileDialog

Application.ScreenUpdating = False
Application.DisplayAlerts = False ' Ãö³¬Äµ§i°T®§
Set FDialog = Application.FileDialog(msoFileDialogFilePicker)
FDialog.Show

For x = 1 To FDialog.SelectedItems.Count
    FPath = FDialog.SelectedItems(x)
    Set WB = Workbooks.Open(FPath)
    For Each sheet In ActiveWorkbook.Sheets
        sheet.Copy After:=ThisWorkbook.Sheets(1)
    Next sheet
    WB.Close
Next

Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

TOP

¦^´_ 5# samwang

    samwang ÁÂÁ§A¦A¦¸ªº¦^ÂÐ,
µ{¦¡¥i¥H¹B¦æ¤F, ¸U¤À·PÁ§A

ÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD