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

Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form versus Control

That is pretty vague Mark. Can you give an example of specific code that
will run in a button click event, but not in a command button event (which
event - assume click). And what you mean by will not run.

If properly structured and qualified, most code should run in either.

--
Regards,
Tom Ogilvy


Mark wrote in message
om...
Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Form versus Control

This is the macro that runs successfully (it's in Module1):
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/14/2003 by Mark Roach
'
Sheets("Sheet2").Select
Worksheets("sheet2").Range("Ak8:BQ20000").Clear
Range("A2:AE99").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"AJ2:AJ3"), CopyToRange:=Range("AK8"), Unique:=False
Sheets("sheet3").Select
End Sub

This is the code from Microsoft Excel Objects/Sheet3 that fails to
execute the advanced filter correctly:
Public Sub CommandButton1_Click()
Sheets("Sheet2").Select
Worksheets("sheet2").Range("Ak8:BQ20000").Clear
Range("A2:AE99").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"AJ2:AJ3"), CopyToRange:=Range("AK8"), Unique:=False
Sheets("sheet3").Select
End Sub





"Tom Ogilvy" wrote in message ...
That is pretty vague Mark. Can you give an example of specific code that
will run in a button click event, but not in a command button event (which
event - assume click). And what you mean by will not run.

If properly structured and qualified, most code should run in either.

--
Regards,
Tom Ogilvy


Mark wrote in message
om...
Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Form versus Control

Check the command button's properties by right-clicking it. If the "Take
Focus" option is set try clearing it.

--
Jim Rech
Excel MVP


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Form versus Control

I have a related question.... (and I bet Tom O. can answer it!)

I've been told that the embedded Control buttons will consume more
memory than the older-style Form buttons used to call the same
subroutine. Any truth to that and if so, why are the Control buttons
the style of choice these days?

Thanks,
Craig


(Mark) wrote in message . com...
Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Form versus Control

Don't know the answer about the memory?

Controls from the Control Toolbox have much more options in the
properties then the Forms controls.

One thing I like is that the control button have a click event instead of assigning a macro to it.
If you copy a sheet to a new workbook for example the button still work
because the click event is in the Sheetmodule.



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Craig" wrote in message om...
I have a related question.... (and I bet Tom O. can answer it!)

I've been told that the embedded Control buttons will consume more
memory than the older-style Form buttons used to call the same
subroutine. Any truth to that and if so, why are the Control buttons
the style of choice these days?

Thanks,
Craig


(Mark) wrote in message . com...
Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form versus Control

I can't say about the memory as I have ever tested it, but I would suspect
that the Control Toolbox Toolbar controls require more overhead and thus
more memory.

The Control Toolbox Toolbar controls are
Documented,
In the object browser (not hidden)
Written about in books and articles
Offer more control
Appear more object oriented
Are the only controls for userforms (in windows versions)

the forms toolbar controls are largely ignored and undocumented since xl97,
less flexible, don't work on userforms under windows (and who uses dialog
boxes). However, they work nicely in many instances on the worksheet and
are more closely integrated with excel, such as when using a defined name as
a dynamic source for the source of a combobox or listbox.

--
Regards,
Tom Ogilvy

"Craig" wrote in message
om...
I have a related question.... (and I bet Tom O. can answer it!)

I've been told that the embedded Control buttons will consume more
memory than the older-style Form buttons used to call the same
subroutine. Any truth to that and if so, why are the Control buttons
the style of choice these days?

Thanks,
Craig


(Mark) wrote in message

. com...
Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form versus Control

Works with forms buttons as well (if you write the event code correctly),
because the copy of the button still points to the event code.

--
regards,
Tom Ogilvy

"Ron de Bruin" wrote in message
...
Don't know the answer about the memory?

Controls from the Control Toolbox have much more options in the
properties then the Forms controls.

One thing I like is that the control button have a click event instead of

assigning a macro to it.
If you copy a sheet to a new workbook for example the button still work
because the click event is in the Sheetmodule.



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Craig" wrote in message

om...
I have a related question.... (and I bet Tom O. can answer it!)

I've been told that the embedded Control buttons will consume more
memory than the older-style Form buttons used to call the same
subroutine. Any truth to that and if so, why are the Control buttons
the style of choice these days?

Thanks,
Craig


(Mark) wrote in message

. com...
Excel has a Control Toolbox and a Forms toolbar.

Both toolbars have a similar icon:
Form has a Button icon for associating a macro,
Control Toolbox has a Control Button that you can copy the code from a
macro into.

I've noticed some code inside a macro will run from the Button but not
the Control Button.

Can anyone help explain this?

Thanks, Mark





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 combobox Gail Excel Discussion (Misc queries) 7 October 2nd 09 07:27 PM
Control on Form leerem Excel Discussion (Misc queries) 3 May 21st 09 05:49 PM
2007 Form Control/ActiveX Control font difference Nikko963 Excel Discussion (Misc queries) 0 April 15th 09 04:21 PM
form control - check box irene c New Users to Excel 1 February 2nd 07 09:23 PM
Form Control Dave Peterson[_3_] Excel Programming 0 September 13th 03 03:33 AM


All times are GMT +1. The time now is 08:38 PM.

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"