Private Sub Workbook_Open()
Dim MyB As Workbook, xB As Workbook, xFile$
Set MyB = ThisWorkbook
xFile = ThisWorkbook.Path & "\修改資料夾\修改檔.xls" '路徑檔名自行修改
Application.ScreenUpdating = False
Set xB = Workbooks.Open(xFile, ReadOnly:=True)
xB.Sheets("工作表A").[A1:H500].Copy MyB.Sheets("工作表a").[A1]
xB.Sheets("工作表B").[AA1:AB20].Copy MyB.Sheets("工作表b").[AA1]
xB.Close 0
End Sub
Private Sub Workbook_Open()
Dim MyB As Workbook, xB As Workbook, xFile$
Set MyB = ThisWorkbook
xFile = ThisWorkbook.Path & "\修改資料夾\修改檔.xls" '路徑檔名自行修改
Application.ScreenUpdating = False
Set xB = Workbooks.Open(xFile, ReadOnly:=True)
Set xB = Workbooks.Open(xFile, ReadOnly:=True)
xB.Sheets("工作表A").Protect "123"
With MyB.Sheets("工作表a")
.Unprotect "123"
xB.Sheets("工作表A").[A1:H500].Copy .[A1]
.Protect "123"
End With
xB.Sheets("工作表B").Protect "123"
With MyB.Sheets("工作表b")
.Unprotect "123"
xB.Sheets("工作表B").[AA1:AB20].Copy .[AA1]
.Protect "123"
End With
xB.Close 0