|
- Private Sub CommandButton1_Click()
- Application.ScreenUpdating = False
- Dim strFullName As String, ran As Range
- Set ran = ThisWorkbook.Worksheets("试验数据库").Range("A:H")
- strFullName = ThisWorkbook.Path & "\" & "备份.xlsx"
- With Workbooks.Open(strFullName, 0)
- ActiveWindow.WindowState = xlMinimized
- ran.Copy .Worksheets(1).Range("A1")
- .Close True
- End With
- Set ran = Nothing
- Application.CutCopyMode = False
- Application.ScreenUpdating = True
- End Sub
- Private Sub CommandButton2_Click()
- Application.ScreenUpdating = False
- Dim strFullName As String, target As Range
- Set target = ThisWorkbook.Worksheets("试验数据库").Range("A1")
- strFullName = ThisWorkbook.Path & "\" & "备份.xlsx"
- With Workbooks.Open(strFullName, 0)
- ActiveWindow.WindowState = xlMinimized
- .Worksheets(1).Range("A:H").Copy target
- .Close False
- End With
- Set target = Nothing
- Application.CutCopyMode = False
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|