CommandButton - Created using Forms, Not Control Toolbox

  • Thread starter Thread starter JMay
  • Start date Start date
J

JMay

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
 
Hi

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

'Your code

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

Mike
 
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?
 
Back
Top