S
Sunday88310
Question is why (IsEmptyWorksheet) can hang up the running of the application
does this statement need a Dim
This statement produces all the system faces and takes 3 minutes to run.
Dim iFaceId As Integer ' Tracks Current FaceID
Dim iColumn As Integer ' Tracks Current column in worksheet
Dim iRow As Integer ' Tracks current Row in worksheet
Dim ctl As CommandBarControl
Dim cbr As CommandBar
If Not IsEmptyWorksheet(ActiveSheet) Then Exit Sub
On Error GoTo Recover
Application.ScreenUpdating = False
Set cbr = CommandBars.Add(Position:=msoBarFloating, MenuBar:=False,
temporary:=True)
Set ctl = cbr.Controls.Add(Type:=msoControlButton, temporary:=True)
iRow = 1
Do
For iColumn = 1 To 10
iFaceId = iFaceId + 1
Application.StatusBar = "FaceID = " & iFaceId
ctl.FaceId = iFaceId
ctl.CopyFace
ActiveSheet.Paste Cells(iRow, iColumn + 1)
Cells(iRow, iColumn).Value = iFaceId
Next iColumn
iRow = iRow + 1
Loop
Recover:
If Err.Number = 1004 Then Resume Next
Application.StatusBar = False
cbr.Delete
End Sub
does this statement need a Dim
This statement produces all the system faces and takes 3 minutes to run.
Dim iFaceId As Integer ' Tracks Current FaceID
Dim iColumn As Integer ' Tracks Current column in worksheet
Dim iRow As Integer ' Tracks current Row in worksheet
Dim ctl As CommandBarControl
Dim cbr As CommandBar
If Not IsEmptyWorksheet(ActiveSheet) Then Exit Sub
On Error GoTo Recover
Application.ScreenUpdating = False
Set cbr = CommandBars.Add(Position:=msoBarFloating, MenuBar:=False,
temporary:=True)
Set ctl = cbr.Controls.Add(Type:=msoControlButton, temporary:=True)
iRow = 1
Do
For iColumn = 1 To 10
iFaceId = iFaceId + 1
Application.StatusBar = "FaceID = " & iFaceId
ctl.FaceId = iFaceId
ctl.CopyFace
ActiveSheet.Paste Cells(iRow, iColumn + 1)
Cells(iRow, iColumn).Value = iFaceId
Next iColumn
iRow = iRow + 1
Loop
Recover:
If Err.Number = 1004 Then Resume Next
Application.StatusBar = False
cbr.Delete
End Sub