Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Form Control Button Name

I have 2 Form Control Buttons that I have assigned macros to in Worksheet 1.
In one of the Buttons, my macro (among other things) copys Sheet 1 from
Worksheet 1, and pastes it into a New Worksheet and attempts to delete the
Control Buttons. The problem is, in Worksheet 1, my Control Buttons are named
"Button 4" and "Button 48". When Sheet 1 from Worksheet 1 gets copied to the
New Worksheet, the Control Buttons names change ("Button 2" and "Button 3" in
one test and "Button 4" and "Button 5" in another test on a different
machine).

How can i overcome this? (is there a wildcard i can use to specify deleting
all Control Buttons? or can i fix the name of he Control Button name when
being copied to the New Worksheet?)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Form Control Button Name


there are two different types of control buttons. One from the
controltoolbox toolbar and one from the Formstoolbar. The method is
slighly different


'control toolbox
Sub test()

For Each obj In Sheets("sheet1").OLEObjects
If TypeName(obj.Object) = "CommandButton" Then
obj.Delete
End If

Next obj

End Sub

'forms
Sub test1()
For Each obj In Sheets("sheet1").Buttons
obj.Delete
Next obj
End Sub


If you have more than one button on the page you may have to look at
the name of the button (what is displayon on the control) to determine
which on eto dlete.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=180227

Microsoft Office Help

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Control Button Color Richard Excel Discussion (Misc queries) 4 April 7th 23 12:24 PM
Button in Form Control SJL New Users to Excel 1 December 30th 09 09:30 PM
How to see which Marco is assgined to a form control button Pennyc Excel Discussion (Misc queries) 2 October 21st 09 06:42 PM
Form Control Button Offset KIM W Excel Programming 1 June 18th 09 11:16 PM
Customizing Form Control Button in 2007 Bob C Excel Discussion (Misc queries) 1 April 12th 08 12:19 PM


All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"