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?)
0
Utf
2/17/2010 10:44:02 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
591 Views

Similar Articles

[PageSpeed] 36

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/showthread.php?t=180227

[url="http://www.thecodecage.com"]Microsoft Office Help[/url]

0
joel
2/17/2010 11:12:59 PM
Reply:

Similar Artilces:

Additional lookup for contacts on opportunity form
Hi, I try to customise CRM 3.0 without any training - therefore a question for which I need some help. On the opportunity form exists a look-up (potentional customer) for contacts/accounts. I'd like to add an aditional one to the form (to replace the decision maker). I tryed to create a new field on the opportunity entity but there's no field-type "look-up". It's also not possible to create a new relationship to the contact entity (both system entity's). Does anybody of you know how I can do this? (if yes - please explain it more detailed...). Thanks Joerg Look...

Forms 07-27-07
Hi, A VB Code is used that has the following line: Me.Visible = False (Me refers to the forms names frmBirthsearch) After this line a second form (form2) is opned based on a query that reads two dates from the frmBirthsearch using the line code: DoCmd.OpenForm "frmBirthdates", acViewNormal at this point frmbearthsearh is hidden. What command shold I add after this in order to close the frmbirthsearch? ...

what is the function and name is of the symbol in each table cell.
Under Paragraph I clicked the Show/Hide Symbol icon so I can now see a symbol at the end of each text within a table cell. I wondered what that is so I tried to use Help to find out. I did find help that mapped a word (like paragraph) into a symbol. But I can't find anywhere where if I know the symbol it will tell me the meaning. Can you tell me how to find such info? Or maybe you can tell me what the function and name is of the symbol in each table cell. Thanks I'm sorry, I meant to sent this to the Word group. Of course, I wouldn't mind getting the info...

Displaying MS Excel Chart control in ASP.NET Application
Hi, We are working on an ASP.NET (VB.NET) application. In one of th screens of our application, we need to show a graph and for this we ar using MS Excel Graph control. We have the graph prepared in Excel. Th application would feed in certain values into certain cells of th excel file and the graph would be drawn by the graph control based o these cells. We need some help on how exactly to display the excel graph contro directly on the screen of ASP.NET application. Thanks for the help oursm -- oursmp ...

Suggest Names While Completing .....
Is there anyway to remove a "suggested name" short of actually turning this feature off? Our CEO's PA has returned from leave but her home email address keeps popping up as an option. Ta Ian When Outlook suggests the name, highlight it with the arrow keys and then press the delete key. "Ian Kynaston" <IKynaston@nospam.propertyoz.com.au> wrote in message news:554f01c4743a$a34b6910$a601280a@phx.gbl... > Is there anyway to remove a "suggested name" short of > actually turning this feature off? > > Our CEO's PA has returned from leave b...

Keeping a table in a form editable and checking that fields are filled in before allowing a save
Firstly apologies if this is the incorrect forum but I was looking for a general word forum and could not find one. Please point me to one if one exists. I am trying to create a form where I want to specify what items need to be filled in. (Review minutes from design reviews). I want to make certain fields mandatory like the date, attendees and check list used and want to block saving of the document with a warning until they are filled in. Is there a way of doing this? Also as a part of the review actions are filled in to a table. depending on how many actions there are the table...

Error 2455 Closing Access 2007 database with form open
I have a form with a subform that is requeried when you select a new key for the main form from a combo box. Everything works fine - usually. But sometimes if you have the form open when you close the database down you get the following error message (twice) in a pop up. You say OK (twice) and the database closes OK "2455 you entered an expression that has an invalid reference to the property form/report" If I close the form before the database I never get the error. If I do not touch the form before you close the database I don't get the error. If I update a field by t...

Excel ask duplicate NAMES when duplicate a worksheets
I have added a NAME called "Above" where point to the cell just above the current cell. The formula is "=INDIRECT("R[-1]C",)" In some workbook, when I duplicate a worksheets, this name will remain silent and work ok. But in some workbooks, when I first duplicate a worksheets, the same name ABOVE will be duplicate and a new local name (belongs to that new worksheet) will be created. If I further duplicate that new worksheets in to a new worksheets, the third worksheets will be warned that a dupicate NAME is existed and ask whether refer to another name or use a ne...

WdfUsbTargetDeviceCreate creates NULL Control Pipe Handle
Hi, We have a usb composite device which has one mass storage interface and another as a network interface. We are developing a WDF driver (NDIS-USB) for the network interface. Immediately after WdfUsbTargetDeviceCreate if I break into the debugger and examine the newly created device, then I see that the Control Pipe Handle is NULL! Here is the actual output: -------- kd> !WDFUSBDEVICE 0x0000057f`fe5905f8 WDFUSBDEVICE 0000057ffe5905f8 ============================= Config descriptor fffffa80037216b0, device descriptor fffffa8001a6fb58 Control USBD_PIPE_HANDLE 000000000000...

Middle mouse button does not always open in new tab anymore
Hi! I am experiencing the problem that when I click with the middle mouse button on a link (for example google search results) it does not always open it in a new tab anymore. In about 20% of the cases it takes over the current tab instead. The same problem is explained here in german: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.de.internetexplorer&tid=cd463718-8df6-4ee4-9e8a-9ee527837f83&cat=&lang=de&cr=DE&sloc=&p=1 But since there was no answer found so far I decided to take it to the next level (english c...

exchange 5.5 will not keep new server name.
We have exchange 5.5 in enviroment where windows server 2003 is setup along with active directory and active direcitory intergrated zone which is replicated to other servers. Problem: I enter the Exchange Server Name followed by the mailbox name then I select the button [CHECK NAME] In the exchange server name field after entering the new exchange server name the old exchange server name is displayed instead. This only happens in office 2003 professional and not in office 2000 professional "old exchange server name" How did you go about changing the name of the server...

building a custom calender control
I'm trying to build a calender control that will allow the user to select a month and display any appoitments / jobs due for that month. I want it to look like the calender in Outlook. i'm having trouble creating this in ACCESS 2007. Could anyone help please? This is a gigantic task. Is there some particular area where you are having a problem? Most people would opt for automation of outlook rather than trying to accomplish this... -- Jack Leach www.tristatemachine.com "I haven''t failed, I''ve found ten thousand ways that don''t wor...

obtaining data in text form from a table
Hi all, I like to be able to obtain the dates in a text format from the table below. ie Test2 8-Feb Test5 4-Feb,8-Feb Test6 4-Feb,5-Feb, 9-Feb Do I need to do this by macros and if so, any help would be appreciated. Table Care Recipient Surname 4-Feb 5-Feb 8-Feb 9-Feb Test1 Test2 8-Feb Test3 Test4 Test5 4-Feb 8-Feb Test6 4-Feb 5-Feb 9-Feb Vlookup should do what you want, as in: =vlookup(a2,Table,2,false) Adjust the ranges t...

Adding a button with a function on protected sheets.
How do i add a button to 'reset/clear' the data on a worksheet that is protected and uses VLookup data (from another worksheet). Everyday this table will have data chosen from combo boxes or manually entered in allowable editable fields and at the end of the day after the files is saved, I need to clear that data for use on the next day. How is this Reset button applied with allowable edit ranges, VLookup data and a protected worksheet? Thanks There's several ways to do this. 1. Instead of straight vlookups, use =IF(ISBLANK(VLOOKUP(....)),"",VLOOKUP(....)) wher...

MemDC & Scroll Control with Mouse Wheel
Ever since I changed to use MemDC, using the mouse wheel made my CSrollView a complete mess. The wheel mouse control was working fine with my flickering version. Then I used MemDC to get rid of flickering issue, now I am having this scrolling issue for using the middle wheel mouse button. What could be wrong? Thanks. On 12 Aug 2005 06:53:36 -0700, guxu@hotmail.com wrote: >Ever since I changed to use MemDC, using the mouse wheel made my >CSrollView a complete mess. The wheel mouse control was working fine >with my flickering version. Then I used MemDC to get rid of flickering &g...

Routing Restrictions button unavailable (gray) no matter what options selected in IMS-->Routing tab
I am running Exchange 5.5 SP4. In Connections-->IMS-->Routing Tab, my "Routing Restrictions" button is unavailable (greyed-out) no matter what options I select. Any suggestions? Thank you. Try installing Exch Admin prog on other machine, apply SP4 and see if you can change it from there. Post back with details. ryanadmin wrote: > I am running Exchange 5.5 SP4. In Connections-->IMS-->Routing Tab, my > "Routing Restrictions" button is unavailable (greyed-out) no matter > what options I select. Any suggestions? Thank you. ...

forms and column lengths
Is there a way to have excel do an auto "carriage return" to the next row when you have reached the specified maximum number of characters in the row above?? Hi there's n o bulit-in feature for this -- Regards Frank Kabel Frankfurt, Germany "Blair" <Blair@discussions.microsoft.com> schrieb im Newsbeitrag news:C1D2CAAD-C4E9-492A-ADF4-CBDB659514A3@microsoft.com... > Is there a way to have excel do an auto "carriage return" to the next row > when you have reached the specified maximum number of characters in the > row > above?? ...

Can I show server name instead of drive letter?
When using the =Cell("filename") function, I would like to show the actual server instead of a drive letter because the letter is dependent on where the server is mapped and not all users have the same mapping. Is this possible? Try using: \\ServerName\drive\... where ServerName is the name of the server and drive is the appropriate drive, and then find the file on the drive from that point. "bfant" wrote: > When using the =Cell("filename") function, I would like to show the actual > server instead of a drive letter because the letter is dependent on...

Enable/Disable a Form Control Based on Security Group Permissions
How do I enable or disable a control in a form based on a user’s security group membership? For example: If I have a checkbox on a form (call it box1), I want box1 to be enabled if the user who opened Access is a member of a security group called “Breaker Test Admin.” For members of any other group (except of course “Admins”), box1 should be disabled. Thank you, for your help! On Mon, 02 Jul 2007 18:57:13 GMT, "BenS" <u35527@uwe> wrote: >How do I enable or disable a control in a form based on a user�s security >group membership? For example: If I have a checkbox on a ...

Trying to Create a pop-up form
Due to size limitations on my main form, I am trying to create a form that, when I select a button, it pops up like a dialog box with the main form, Frm_Escheat, in the background I've created a qry which is the record source on my pop-up form. In the criteria of the query is: [Forms]![Frm_Escheat]![statecode] where [statecode] is the field from the Master Form. So, my "pop-up" form is activated when I select the button, but my problem is that it just goes to the pop-up form without the main form showing in the background. Thanks for your help. It would probably hel...

set value of a group of activex control points
Have a spreadsheet that has some 20+ activex control points (option buttons). Is there a way to group all these controls together & set their initial values the same? Trying to setup a "reset" type of operation that would clear all control points. I can do them individually via properties, but it's too time consuming. Any suggestions? ...

Auto Fill a Textbox in Form
What is the simplest way to auto fill a textbox (in a form) with the maximum values of more than one field in the last record entered, in the same table? Can the =DMax function be used for this? I have tried =DMax(“[field_1]”, “[field_2]”, “[field_3]” , “table_1”)+1, but this doesn’t work. Is something like this possible with two or more feilds with DMax? Thanks -- Message posted via http://www.accessmonster.com See MinOfList() and MaxOfList() here: http://allenbrowne.com/func-09.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allen...

user forms #5
Hello, I have created a user form (click on New Employee). How do I get the information entered in to this form to appear in the correct columns in the Payroll data sheet? And how do I get the combo boxes to display the drop down information from the sheet called input. Regards Runner77 -- Runner77 ------------------------------------------------------------------------ Runner77's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30388 View this thread: http://www.excelforum.com/showthread.php?threadid=500502 ...

Command Button to Sort and Filter by Selection
Is it possible to create a command button on a form that will allow you to sort records or to use the Filter by Selction option? They are not choices I can select while using the wizard or the macro builder. However, both of these would be extremely useful as I'm building a database for someone who has never used a database before and isn't all that comfortable with computers in general. I am using Access 2003 and I am NOT familiar with Access Visual Basic, Java or building macros from scratch. I'm sure there is a way to use these tools to create what I want, ...

Adding GAL users into a custom form
Hi, I have created a custom form, and am required to add a series of approvers. What I am trying to achieve is: * Add users from my GAL into a text field, so that when the form is sent, they do not get initially CC'ed the form. Is this achievable, and if so, how do I do it (if you could help by including any appropriate code, that would be great). Regards, Rick ...