Face ID error, any suggestion?

R

Rock

I created a small sub to display faces and their ID numbers.
Problem is the sub will not run if the face is more than 79.

In this attached sub, if you replace 79 by a number more than 79, it
will end up by error.

Do you have any suggestion?
Thanks!
Rock


Sub faceID()

'Add the "Face IDs" toolbar
Toolbars.Add "Face IDs"
i0 = 1
For i = i0 To i0 + *79*
Toolbars("Face IDs").ToolbarButtons.Add i
With Toolbars("Face IDs").ToolbarButtons(i)
..Name = i
End With
Next i
Toolbars("Face IDs").Visible = True

End Sub
 
T

Tom Ogilvy

Try it like this:

Sub faceID()
On Error Resume Next
'Add the "Face IDs" toolbar
Toolbars.Add "Face IDs"
i0 = 1
For i = i0 To i0 + 150
Toolbars("Face IDs").ToolbarButtons.Add i
With Toolbars("Face IDs").ToolbarButtons(i)
Name = i
End With
Next i
Toolbars("Face IDs").Visible = True

End Sub
 
R

Rock

Dear Tom Ogilvy!

It is Ok now and then the problem is the name cannot be written over
the default names that assigned by Excel.

Thank you very much!
Rock
 
T

Tom Ogilvy

I guess if that were the case and your code is renaming the buttons, you
would have an error on your first button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top