ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   button (https://www.excelbanter.com/excel-programming/319585-button.html)

luc

button
 
how can i check if a button already exists in a certain sheet on opening of
a file?



Bob Phillips[_6_]

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?






All times are GMT +1. The time now is 06:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com