PC Review


Reply
Thread Tools Rate Thread

Command button "selected"

 
 
pgarcia
Guest
Posts: n/a
 
      28th Jan 2008
When you click on a command button, it seem to be selected always and when a
user does not know that and they click the enter button, it runs the macro
again. How do de-select the command button once it's clicked?

Thanks
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      28th Jan 2008
Disable it within the assigned macro

ActiveSheet.Buttons(Application.Caller).Enabled = False


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"pgarcia" <(E-Mail Removed)> wrote in message
news:CEA56C87-2DC5-45CA-92B9-(E-Mail Removed)...
> When you click on a command button, it seem to be selected always and when
> a
> user does not know that and they click the enter button, it runs the macro
> again. How do de-select the command button once it's clicked?
>
> Thanks



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Jan 2008
Are these commandbuttons on a worksheet?

Are you using xl97?

If you are, then change the .takefocusonclick property to false. This was fixed
in xl2k.

If you ever use a control that doesn't have that property, you could also add a
line to the code:

activecell.activate

(It'll work with the commandbutton, too.)

pgarcia wrote:
>
> When you click on a command button, it seem to be selected always and when a
> user does not know that and they click the enter button, it runs the macro
> again. How do de-select the command button once it's clicked?
>
> Thanks


--

Dave Peterson
 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      28th Jan 2008
Oh, the command button takes you to another tab/sheet, so that did not work.

"Bob Phillips" wrote:

> Disable it within the assigned macro
>
> ActiveSheet.Buttons(Application.Caller).Enabled = False
>
>
> --
> ---
> HTH
>
> Bob
>
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
>
>
> "pgarcia" <(E-Mail Removed)> wrote in message
> news:CEA56C87-2DC5-45CA-92B9-(E-Mail Removed)...
> > When you click on a command button, it seem to be selected always and when
> > a
> > user does not know that and they click the enter button, it runs the macro
> > again. How do de-select the command button once it's clicked?
> >
> > Thanks

>
>
>

 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      28th Jan 2008
Great, that did the trick.

"Dave Peterson" wrote:

> Are these commandbuttons on a worksheet?
>
> Are you using xl97?
>
> If you are, then change the .takefocusonclick property to false. This was fixed
> in xl2k.
>
> If you ever use a control that doesn't have that property, you could also add a
> line to the code:
>
> activecell.activate
>
> (It'll work with the commandbutton, too.)
>
> pgarcia wrote:
> >
> > When you click on a command button, it seem to be selected always and when a
> > user does not know that and they click the enter button, it runs the macro
> > again. How do de-select the command button once it's clicked?
> >
> > Thanks

>
> --
>
> Dave Peterson
>

 
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 to make Format Vision "Yes" and "No" Frank Situmorang Microsoft Access Reports 2 10th Apr 2008 03:59 AM
Re: Print Report "selected record" from command button Rick Brandt Microsoft Access Reports 0 5th Jan 2007 03:00 PM
command button and the "enter" and "tab" keys =?Utf-8?B?ZHIgY2h1Y2s=?= Microsoft Excel Programming 10 11th Sep 2006 12:09 AM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 1 29th Apr 2006 02:05 AM
Re: Is there a "Go Back" button in Word 6.0 or "Keyboard Command" David Candy Windows XP General 1 30th Mar 2004 10:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:49 PM.