Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Workbook_Open() Error

Greetings,

I am attempting to turn one CommandButton visible and to make another
one not visible when I open my workbook. What I am getting is a
Visual Basic error message:

Run-time error '424'
Object required

This is what I tried in "ThisWorkbook" (the * is the line
highlighted by Debug):

Private Sub Workbook_Open()

Sheets("Enter").Select
* CommandButton1,Visible = True
CommandButton2,Visible = False
Range("AP2").Select

End Sub

Anyone see what is wrong with code?

Any help would be most appreciated.

TIA

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Workbook_Open() Error

You need a dot instead of a ,

CommandButton1.Visible

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Minitman" wrote in message ...
Greetings,

I am attempting to turn one CommandButton visible and to make another
one not visible when I open my workbook. What I am getting is a
Visual Basic error message:

Run-time error '424'
Object required

This is what I tried in "ThisWorkbook" (the * is the line
highlighted by Debug):

Private Sub Workbook_Open()

Sheets("Enter").Select
* CommandButton1,Visible = True
CommandButton2,Visible = False
Range("AP2").Select

End Sub

Anyone see what is wrong with code?

Any help would be most appreciated.

TIA

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook_Open() Error

Hi



Sheets("Enter").Activate
ActiveSheet.CommandButton1.Visible = True
ActiveSheet.CommandButton2.Visible = False
Range("AP2").Select


Slawek(Poland)



Uzytkownik "Minitman" napisal w wiadomosci
...
Greetings,

I am attempting to turn one CommandButton visible and to make another
one not visible when I open my workbook. What I am getting is a
Visual Basic error message:

Run-time error '424'
Object required

This is what I tried in "ThisWorkbook" (the * is the line
highlighted by Debug):

Private Sub Workbook_Open()

Sheets("Enter").Select
* CommandButton1,Visible = True
CommandButton2,Visible = False
Range("AP2").Select

End Sub

Anyone see what is wrong with code?

Any help would be most appreciated.

TIA

-Minitman



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Workbook_Open() Error

You need a dot separator not comma, and you have to qualify the button with
the sheet

Private Sub Workbook_Open()

Sheets("Enter").Select
ActiveSheet.CommandButton1.Visible = True
ActiveSheet.CommandButton2.Visible = False
Range("AP2").Select

End Sub

or

Private Sub Workbook_Open()

With Sheets("Enter").
.Activate
.CommandButton1.Visible = True
.CommandButton2.Visible = False
.Range("AP2").Select
End With

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Minitman" wrote in message
...
Greetings,

I am attempting to turn one CommandButton visible and to make another
one not visible when I open my workbook. What I am getting is a
Visual Basic error message:

Run-time error '424'
Object required

This is what I tried in "ThisWorkbook" (the * is the line
highlighted by Debug):

Private Sub Workbook_Open()

Sheets("Enter").Select
* CommandButton1,Visible = True
CommandButton2,Visible = False
Range("AP2").Select

End Sub

Anyone see what is wrong with code?

Any help would be most appreciated.

TIA

-Minitman



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Workbook_Open() Error

Hey Ron,

Good catch on the typo. That, however, is not the problem (I typed
the code rather then copied). Do you see any other possibilities?


On Fri, 2 Apr 2004 20:25:59 +0200, "Ron de Bruin"
wrote:

You need a dot instead of a ,

CommandButton1.Visible




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Workbook_Open() Error

Thank you Slawek and Bob.

That is just what was missing.

-Minitman


On Fri, 02 Apr 2004 12:54:32 -0600, Minitman
wrote:

Hey Ron,

Good catch on the typo. That, however, is not the problem (I typed
the code rather then copied). Do you see any other possibilities?


On Fri, 2 Apr 2004 20:25:59 +0200, "Ron de Bruin"
wrote:

You need a dot instead of a ,

CommandButton1.Visible


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
Workbook_Open() Event Bill Martin Excel Discussion (Misc queries) 9 January 13th 06 08:24 PM
Workbook_Open () Bill Martin Excel Discussion (Misc queries) 12 December 20th 05 05:37 PM
Workbook_Open Event Squid[_2_] Excel Programming 7 February 8th 04 06:49 PM
WorkBook_Open Event Squid[_3_] Excel Programming 1 February 8th 04 02:45 AM
Workbook_Open() error Ruan[_3_] Excel Programming 2 September 13th 03 09:13 PM


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

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

About Us

"It's about Microsoft Excel"