PC Review


Reply
Thread Tools Rate Thread

CommandButton - Created using Forms, Not Control Toolbox

 
 
JMay
Guest
Posts: n/a
 
      12th Dec 2009
I just created a button on my Sheet1 and assigned a Macro to it.
When I right-click on this button - I see in my NameBox "Button 1"
without the quotes.

In my Workbook_Open code I want to HIDE this button.
1st What is the code to include in the WB_Open code to do this?

After performing another procedure using VBA, what line near the bottom
of that code would make my Button 1 visible?

Or is it best to to Only load the Button at the end of the above procedure?

TIA,

Jim
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      12th Dec 2009
Hi

Sheets("Sheet1").Shapes("Button 1").Visible = False

'Your code

Sheets("Sheet1").Shapes("Button 1").Visible = True

Mike

"JMay" wrote:

> I just created a button on my Sheet1 and assigned a Macro to it.
> When I right-click on this button - I see in my NameBox "Button 1"
> without the quotes.
>
> In my Workbook_Open code I want to HIDE this button.
> 1st What is the code to include in the WB_Open code to do this?
>
> After performing another procedure using VBA, what line near the bottom
> of that code would make my Button 1 visible?
>
> Or is it best to to Only load the Button at the end of the above procedure?
>
> TIA,
>
> Jim

 
Reply With Quote
 
JMay
Guest
Posts: n/a
 
      12th Dec 2009
Mike Thanks alot.

I NOW have:

Private Sub Workbook_Open()
Sheets("Sheet1").Shapes("Button 1").Visible = False
Call Main
End Sub

Sub Main()
Dim res As String
res = MsgBox("Do you need help" & vbNewLine & "from your supervisor?",
vbQuestion + vbYesNo, "The Question of the Day")
If res = vbYes Then
.....

But As I now Close and reopen the file the Command button is visible
UNTIL I complete the Message box (Which seems to grab focus before the
statement line Sheets("Sheet1").Shapes("Button 1").Visible = False
How can I modify this so the Button is not visible until AFTER the
completion of the Message Box?


"Mike H" wrote:

> Hi
>
> Sheets("Sheet1").Shapes("Button 1").Visible = False
>
> 'Your code
>
> Sheets("Sheet1").Shapes("Button 1").Visible = True
>
> Mike
>
> "JMay" wrote:
>
> > I just created a button on my Sheet1 and assigned a Macro to it.
> > When I right-click on this button - I see in my NameBox "Button 1"
> > without the quotes.
> >
> > In my Workbook_Open code I want to HIDE this button.
> > 1st What is the code to include in the WB_Open code to do this?
> >
> > After performing another procedure using VBA, what line near the bottom
> > of that code would make my Button 1 visible?
> >
> > Or is it best to to Only load the Button at the end of the above procedure?
> >
> > TIA,
> >
> > Jim

 
Reply With Quote
 
JMay
Guest
Posts: n/a
 
      12th Dec 2009
Mike, Sorry - It's Working

\I jimped the GUN -- THANKS!!


"Mike H" wrote:

> Hi
>
> Sheets("Sheet1").Shapes("Button 1").Visible = False
>
> 'Your code
>
> Sheets("Sheet1").Shapes("Button 1").Visible = True
>
> Mike
>
> "JMay" wrote:
>
> > I just created a button on my Sheet1 and assigned a Macro to it.
> > When I right-click on this button - I see in my NameBox "Button 1"
> > without the quotes.
> >
> > In my Workbook_Open code I want to HIDE this button.
> > 1st What is the code to include in the WB_Open code to do this?
> >
> > After performing another procedure using VBA, what line near the bottom
> > of that code would make my Button 1 visible?
> >
> > Or is it best to to Only load the Button at the end of the above procedure?
> >
> > TIA,
> >
> > Jim

 
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
Forms - using Forms Toolbar and Control toolbox in one document trainhappy Microsoft Word Document Management 1 12th Jun 2008 09:07 PM
Re: CommandButton - Created using Forms toolbar Bob Phillips Microsoft Excel Misc 5 24th Jan 2007 09:50 AM
Red X in worksheet controls created with the Excel control toolbox =?Utf-8?B?TWF0dCBIdXJsZXk=?= Microsoft Excel Crashes 0 13th Oct 2005 01:23 AM
Help to edit (bold, colour etc) words in a text box created by control toolbox Jonathan hill via OfficeKB.com Microsoft Excel Misc 1 12th Feb 2005 01:00 PM
Control Toolbox vs Forms =?Utf-8?B?UGV0ZXI=?= Microsoft Excel Programming 3 5th Feb 2004 04:28 PM


Features
 

Advertising
 

Newsgroups
 


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