Thread: button
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default button

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)


"luc" wrote in message
...
how can i check if a button already exists in a certain sheet on opening

of
a file?