|
保存老師跳是否兼容對話框
Private Sub CommandButton2_Click()
Dim i As Integer
Dim j As Integer
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With Me.ListBox1
For i = (.ListCount - 1) To 5 Step -1
If .Selected(i) Then
Worksheets(.List(i)).Copy
ActiveWorkbook.SaveAs Filename:=Replace(Range("i5").Value, ".prt", ".xls"), FileFormat:=xlExcel8
ActiveWorkbook.Close True
Application.ScreenUpdating = True
Application.DisplayAlerts = True
ErrorHandler:
Debug.Print Err.Number & Err.Description
Resume Next
End If
Next
End With
End Sub
Private Sub ListBox1_Click()
End Sub
Private Sub UserForm_Initialize()
Dim sht
For Each sht In ActiveWorkbook.Sheets
Me.ListBox1.AddItem sht.Name
Next
End Sub
這個就不會跳
Sub hwc2ycy( )
Dim i As Byte
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 6 To Worksheets.Count
Worksheets(i).Copy
ActiveWorkbook.SaveAs Filename:=Replace(Range("i5").Value, ".prt", ".xls"), FileFormat:=xlExcel8
ActiveWorkbook.Close True
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "OK"
ErrorHandler:
Debug.Print Err.Number & Err.Description
Resume Next
End Sub
- Private Sub CommandButton2_Click()
- Dim i As Integer
- Dim j As Integer
- On Error GoTo ErrorHandler
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With Me.ListBox1
- For i = (.ListCount - 1) To 0 Step -1
- If .Selected(i) Then
- Worksheets(.List(i)).Copy
- ActiveWorkbook.SaveAs Filename:=Replace(Range("i5").Value, ".prt", ".xls"), FileFormat:=xlExcel8
- ActiveWorkbook.Close True
- End If
- Next
- End With
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- Exit Sub
- ErrorHandler:
- Debug.Print Err.Number & Err.Description
- Err.Clear
- Resume Next
- End Sub
复制代码这两句放错位置了。
Application.ScreenUpdating = True
Application.DisplayAlerts = True
|
|