Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Restore an invisible commandbutton on open?

Hi All. I've got a spreadsheet with a couple of command buttons that launch
vba prcedures. After the user does their stuff, I want a third button that
will hide all three buttons. I've got that part down:

Private Sub Hide_Click()
button1.Visible = False
button2.Visible = False
Hide.Visible = False
End Sub

But I want those three buttons to reappear when the workbook is opened. I've
got an auto-run macro in ThisWorkbook:

Sub Workbook_Open()
button1.Visible = True
button2.Visible = True
Hide.Visible = True
End Sub

On opening the workbook, I get Run-time error '424': Object required.

If I go into design mode, The buttons do appear and I can manually make them
visible again by making their visible property = true. Just want that
automated.

Thanks for any help!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Restore an invisible commandbutton on open?

You need to be more explicit in your referencing of the buttons. The on open
will be in a general module which by default will act upon the active sheet
(whatever that might be at the time). Try something more like this...

Sub Workbook_Open()
Sheets("Sheet 1").button1.Visible = True
Sheets("Sheet 1").button2.Visible = True
Sheets("Sheet 1").Hide.Visible = True
End Sub

--
HTH...

Jim Thomlinson


"Mike Proffit" wrote:

Hi All. I've got a spreadsheet with a couple of command buttons that launch
vba prcedures. After the user does their stuff, I want a third button that
will hide all three buttons. I've got that part down:

Private Sub Hide_Click()
button1.Visible = False
button2.Visible = False
Hide.Visible = False
End Sub

But I want those three buttons to reappear when the workbook is opened. I've
got an auto-run macro in ThisWorkbook:

Sub Workbook_Open()
button1.Visible = True
button2.Visible = True
Hide.Visible = True
End Sub

On opening the workbook, I get Run-time error '424': Object required.

If I go into design mode, The buttons do appear and I can manually make them
visible again by making their visible property = true. Just want that
automated.

Thanks for any help!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandButton to open a Excel workbook aussiegirlone Excel Discussion (Misc queries) 2 March 25th 09 01:34 AM
how to get commandbutton name Sean Excel Programming 2 October 17th 06 08:49 AM
CommandButton in Excel to open another Application JohannM Excel Worksheet Functions 0 September 13th 06 09:29 PM
Commandbutton to Workbook Open Richard Excel Programming 6 February 28th 06 03:43 AM
CommandButton chris[_12_] Excel Programming 1 April 15th 04 01:01 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"