===============================================================
Sub 匯入B檔案資料至本檔案()
Dim MyBook As Workbook, uPath, uFile, j&, Jm&
Set MyBook = ThisWorkbook
uPath = "\\10.40.1.12\PRIME\"
uFile = "B檔案.xls"
If Dir(uPath & uFile) = "" Then MsgBox "※找不到〔" & uFile & "〕檔案,請確認! ", 0 + 16: Exit Sub
For j = 1 To Workbooks.Count
If Workbooks(j).Name = uFile Then Jm = 1: Exit For
Next j
Application.ScreenUpdating = False
If Jm = 0 Then Workbooks.Open uPath & uFile
Workbooks(uFile).Sheets("Sheet1").Rows("12:30").Copy MyBook.Sheets("Sheet1").Rows("12:30")
Workbooks(uFile).Close SaveChanges:=False
MsgBox "∼∼複製資料完成∼∼ "
End Sub作者: dechiuan999 時間: 2011-10-19 07:20