PC Review


Reply
Thread Tools Rate Thread

Cannot Find Button From Control Properties

 
 
cdun2
Guest
Posts: n/a
 
      11th Jun 2007
Hello,
On my worksheet, I have dropped a button control from the Forms
Toolbar. I have aasigned a macro to the button. The on click event
(??) of the button fires the macro properly, and I get the results I
expect. However, a cell has to be edited before the button can be
clicked. Before the button is clickable, I have to be out of edit
mode.

In VBA, I cannot find a way to reference this button control. The
button is not in a form, its embedded within the worksheet. I would
like to be able to exit edit mode when I mouseOver the button.

What should I do?

Thank you for your help!

cdun2

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      11th Jun 2007
You are out of luck on that one. No code will run while a cell is in edit
mode. No events fire... Nothing...

That being said you can reference a button from the forms toolbar like this...
MsgBox Sheets("Sheet1").Buttons("Button 1").Caption

--
HTH...

Jim Thomlinson


"cdun2" wrote:

> Hello,
> On my worksheet, I have dropped a button control from the Forms
> Toolbar. I have aasigned a macro to the button. The on click event
> (??) of the button fires the macro properly, and I get the results I
> expect. However, a cell has to be edited before the button can be
> clicked. Before the button is clickable, I have to be out of edit
> mode.
>
> In VBA, I cannot find a way to reference this button control. The
> button is not in a form, its embedded within the worksheet. I would
> like to be able to exit edit mode when I mouseOver the button.
>
> What should I do?
>
> Thank you for your help!
>
> cdun2
>
>

 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      12th Jun 2007
Here is a solution you might want to persue. When the cell is finished being
edited you could make the button visible (or enabled although that
functionallity is not to great in buttons from the forms toolbar as the
button is not greyed out). Plece code similar to this in the sheet where you
have the cell to be edited...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then 'Where A1 is the edited cell
Sheets("Sheet1").Buttons("Button 1").Visible = False
else
Sheets("Sheet1").Buttons("Button 1").Visible = True
End If
End Sub

This code is only a sample and not intended as your final code. I am unclear
as to when this code is valid to be run and how you want the button to work...
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

> You are out of luck on that one. No code will run while a cell is in edit
> mode. No events fire... Nothing...
>
> That being said you can reference a button from the forms toolbar like this...
> MsgBox Sheets("Sheet1").Buttons("Button 1").Caption
>
> --
> HTH...
>
> Jim Thomlinson
>
>
> "cdun2" wrote:
>
> > Hello,
> > On my worksheet, I have dropped a button control from the Forms
> > Toolbar. I have aasigned a macro to the button. The on click event
> > (??) of the button fires the macro properly, and I get the results I
> > expect. However, a cell has to be edited before the button can be
> > clicked. Before the button is clickable, I have to be out of edit
> > mode.
> >
> > In VBA, I cannot find a way to reference this button control. The
> > button is not in a form, its embedded within the worksheet. I would
> > like to be able to exit edit mode when I mouseOver the button.
> >
> > What should I do?
> >
> > Thank you for your help!
> >
> > cdun2
> >
> >

 
Reply With Quote
 
cdun2
Guest
Posts: n/a
 
      12th Jun 2007
Thanks for this input, I'll try this approach.

On Jun 11, 6:09 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com> wrote:
> Here is a solution you might want to persue. When the cell is finished being
> edited you could make the button visible (or enabled although that
> functionallity is not to great in buttons from the forms toolbar as the
> button is not greyed out). Plece code similar to this in the sheet where you
> have the cell to be edited...
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Address = "$A$1" Then 'Where A1 is the edited cell
> Sheets("Sheet1").Buttons("Button 1").Visible = False
> else
> Sheets("Sheet1").Buttons("Button 1").Visible = True
> End If
> End Sub
>
> This code is only a sample and not intended as your final code. I am unclear
> as to when this code is valid to be run and how you want the button to work...
> --
> HTH...
>
> Jim Thomlinson
>
>
>
> "Jim Thomlinson" wrote:
> > You are out of luck on that one. No code will run while a cell is in edit
> > mode. No events fire... Nothing...

>
> > That being said you can reference a button from the forms toolbar like this...
> > MsgBox Sheets("Sheet1").Buttons("Button 1").Caption

>
> > --
> > HTH...

>
> > Jim Thomlinson

>
> > "cdun2" wrote:

>
> > > Hello,
> > > On my worksheet, I have dropped a button control from the Forms
> > > Toolbar. I have aasigned a macro to the button. The on click event
> > > (??) of the button fires the macro properly, and I get the results I
> > > expect. However, a cell has to be edited before the button can be
> > > clicked. Before the button is clickable, I have to be out of edit
> > > mode.

>
> > > In VBA, I cannot find a way to reference this button control. The
> > > button is not in a form, its embedded within the worksheet. I would
> > > like to be able to exit edit mode when I mouseOver the button.

>
> > > What should I do?

>
> > > Thank you for your help!

>
> > >cdun2- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button Control Properties =?Utf-8?B?Sm9zaWFoVw==?= Microsoft Excel Misc 1 11th May 2007 08:45 PM
I can't find the command button control object in Excel 2007 =?Utf-8?B?UmFhcw==?= Microsoft Excel Misc 4 2nd Apr 2007 03:46 PM
send message to win32 app to press button control - remote control button Danny Microsoft C# .NET 2 2nd Feb 2007 02:10 PM
Custom button from a Control class doesn't appear as a choice for OK/Cancel button in a Form properties CroDude Microsoft C# .NET 3 28th Jun 2005 06:27 PM
Find Button Control in DataList Footer =?Utf-8?B?Q2hyaXMgRmluaw==?= Microsoft ASP .NET 2 27th Sep 2004 02:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:40 AM.