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

[µo°Ý] VBA Application.FileDialog À³¥Î

[µo°Ý] VBA Application.FileDialog À³¥Î

¤µ¤é¬Ý¨ì¤@¨Ç .¨Ï¥Î VBA ªº Application.FileDialog «Ø¥ßÀɮשΥؿý¿ï¾Ü¹ï¸Ü®Ø¡AÅý¨Ï¥ÎªÌ¥H·Æ¹«¿ï¾ÜÀɮשΥؿý¡C
½Ð°Ý¬O§_¥i¥H±N«ü©w¿ï¥X¨Óworkbooks( Data)  copy ²Ä¤@­Ó¤u§@ªí ¾ã­¶¨ì ¨ì²{¦b¦³vba workbook«ü©wªºsheets  "TEST BOOK"?
­n«ç»ò§ï,¬ß¤j¤j½ç±Ð

test.zip (29.43 KB)


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

¦^´_ 1# john2006168

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

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

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

For x = 1 To FDialog.SelectedItems.Count
    FPath = FDialog.SelectedItems(x)
    Set WB = Workbooks.Open(FPath)
    With Sheets(1).UsedRange
        .Copy Workbooks(fileorg).Sheets(1).Range("a1")
    End With

    WB.Close
Next

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

TOP

¦^´_ 2# samwang

ÁÂÁ¦ѮvÀ°¦£,¥i¥H¹B¦æ.µo²{¤£Â_¥h°µ½m²ß,¦A¥[¦U¦ì¤j¤jªº«ü¾É,³o¤è­±ªºª¾ÃÑ·|ºCºC¼W¥[¤F«Ü¦h.

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD