| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

06-23-11, 04:34
|
|
Registered User
|
|
Join Date: Oct 2003
Location: London
Posts: 291
|
|
|
Buttons in Excel
|
|
Hi,
Does anyone know if it's possible to turn a button placed on sheet1 to visible=False and visible=True.
What I'm trying to do is something along the lines of the below, but I can't find a way in VB to pick up control of the buttons.
Worksheets.("Sheet1").Button("Button1").visible = False
Thanks
|
|

06-23-11, 06:29
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
|
|
probably best to ask this in the Excel forum....
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|

06-23-11, 08:06
|
|
Registered User
|
|
Join Date: Oct 2003
Location: London
Posts: 291
|
|
|
VB Buttons in Excel
|
|
Hi,
Does anyone know if it's possible to turn a button placed on sheet1 to visible=False and visible=True.
What I'm trying to do is something along the lines of the below, but I can't find a way in VB to pick up control of the buttons.
Worksheets.("Sheet1").Button("Button1").visible = False
Thanks
|
|

06-23-11, 11:06
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
|
|
What do you want to achieve? The code is correctly formatted, but on its own it will not do anything.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
|
|

06-23-11, 12:00
|
|
Registered User
|
|
Join Date: Oct 2003
Location: London
Posts: 291
|
|
I have 3 buttons on an excel page (Sheet1). The buttons are named Button1, Button2, Button3.
My ideal starting point would be to make button2, and button3 invisible from the starting point.
Button1 is a submit button. When pressed I would like the submit button to be hidden, and Button1, and Button2 to become visible.
No matter what I try, I'm just getting messages 'Object doesn't support this property or message".
I actually don't care how it's done - The buttons could be made invisible; greyed out; shrunk in size; not even present to start with and then created as part of the command behind button1...
The long winded solution I have at the moment is to put if commands behind button1 and 2 stating that if the current windows user, is the same user who pressed submit, then do nothing... (There's a hidden audit sheet which tracks who pressed submit).
|
|

06-23-11, 12:18
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
|
|
Are you using form buttons or ActiveX buttons? I think that you will only be able to use VBA to control their status with the latter.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
|
|

06-23-11, 19:29
|
|
Registered User
|
|
Join Date: Sep 2008
Location: London, UK
Posts: 495
|
|
The Worksheet class does not have a Button property which is why you get that error. As weejas said, the correct answer depends on what type of buttons they are (ActiveX vs Forms) - but both can be made hidden via VBA. Tell use which type they are and we can show you how to do it! 
|
|

06-23-11, 19:30
|
|
Registered User
|
|
Join Date: Sep 2008
Location: London, UK
Posts: 495
|
|
|
|

06-24-11, 03:51
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
|
|
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|

06-24-11, 05:25
|
|
Registered User
|
|
Join Date: Oct 2003
Location: London
Posts: 291
|
|
Only duplicate because you asked me to post it in the excel forum, and then moved the 1st one after I posted the 2nd!
Thanks for your help everyone. I'll consider using ActiveX buttons but it might be easier just to put my if condition in the subs. At least I know now that the route I was trying was a dead-end.
|
|

06-24-11, 06:56
|
|
Registered User
|
|
Join Date: Sep 2008
Location: London, UK
Posts: 495
|
|
Quote:
Originally Posted by christyxo
At least I know now that the route I was trying was a dead-end.
|
It wasn't a dead end!
As I said, you can do it with either forms controls or activeX controls: we were just waiting for you to clarify which you are using so we could show you the correct approach.
|
|

06-24-11, 07:41
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
|
|
Quote:
Originally Posted by christyxo
Only duplicate because you asked me to post it in the excel forum, and then moved the 1st one after I posted the 2nd! 
|
not quite true
I made the posting about Excel and moved the thread at the same time.....
but who cares, ultimately you got the answer you needed (I hope)
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|

07-18-11, 11:42
|
|
Registered User
|
|
Join Date: Oct 2003
Location: London
Posts: 291
|
|
Thanks all; I revisited this and found that it's a lot simpler than expected;
Code:
ActiveSheet.Shapes("Button 01").Visible = True / False
|
|

07-18-11, 15:14
|
|
Registered User
|
|
Join Date: Sep 2008
Location: London, UK
Posts: 495
|
|
In that case you are using Forms controls.
Code:
ActiveSheet.Buttons("Button 01").Visible = True / False
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|