button

  • Thread starter Thread starter luc
  • Start date Start date
L

luc

how can i check if a button already exists in a certain sheet on opening of
a file?
 
What sort of button, forms, control tolbox?

If the former try

Dim oBtn As Object

On Error Resume Next
Set oBtn = ActiveSheet.Buttons("Button 1")
If Not oBtn Is Nothing Then
MsgBox "Button 1 already exists"
End If

If the latter, then

Dim oOLE As Object

On Error Resume Next
Set oOLE = ActiveSheet.OLEObjects("CommandButton1")
If Not oOLE Is Nothing Then
MsgBox "already exists"
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top