Oct 7, 2002 #1 denis60 Technical User Joined Apr 19, 2001 Messages 89 Location CA How do i check, when i open my worksheet in excel, if all my buttons (on my sheet) are still there and if not add them
How do i check, when i open my worksheet in excel, if all my buttons (on my sheet) are still there and if not add them
Oct 8, 2002 #2 krupa Programmer Joined Oct 8, 2002 Messages 5 Location US Hey, If you know the button name. Then you can do a dummy check on the button. FOr example if you have a button called MyButton on the sheet Hello then : msgbox Worksheets("Hello".MyButton will do one of two things. If it exists then it will display true/false. if it does not exist you get on error. So you could do this Dim DummyString as string on error goto createButton dummystring=Worksheets("Hello".MyButton createButton: 'write the code to create your new button here. Hope this helps, krupa Upvote 0 Downvote
Hey, If you know the button name. Then you can do a dummy check on the button. FOr example if you have a button called MyButton on the sheet Hello then : msgbox Worksheets("Hello".MyButton will do one of two things. If it exists then it will display true/false. if it does not exist you get on error. So you could do this Dim DummyString as string on error goto createButton dummystring=Worksheets("Hello".MyButton createButton: 'write the code to create your new button here. Hope this helps, krupa
Oct 8, 2002 #3 dwilson01 Technical User Joined Apr 3, 2001 Messages 80 Location US To check for the command buttons you can use the following to print the names the immediate window. If you know the names of the buttons. Code: For Each cmd In ActiveSheet.Shapes Debug.Print cmd.Name Next After determining which buttons are there, you can add teh buttons that are not. If you need more assistance with this, let me know. Dave Upvote 0 Downvote
To check for the command buttons you can use the following to print the names the immediate window. If you know the names of the buttons. Code: For Each cmd In ActiveSheet.Shapes Debug.Print cmd.Name Next After determining which buttons are there, you can add teh buttons that are not. If you need more assistance with this, let me know. Dave
Oct 23, 2002 Thread starter #4 denis60 Technical User Joined Apr 19, 2001 Messages 89 Location CA Thanks folks, yours exemples works good. Your the bests Upvote 0 Downvote