hidden vb object is not hidden when excel workbook is first opened

T

Tomu

I have an Excel97 spreadsheet containing a number of vba objects
(command buttons, msgbox, etc.) with the VISIBLE property set to
FALSE. These are normally programmed to appear in response to another
event on the worksheet, and become invisible when clicked. They do
this OK as programmed. However (newbie problem), when I first open
the workbook these objects are visible and I have to click them to
hide them. How do I go about initializing these objects so that they
are hidden from the start? The "visible=false" property doesn't seem
to be enough.

(Application example: I have a visible cmdButton to open another
workbook which when clicked brings up a previously invisible password
msgbox. After password is entered, the password msgbox disappears and
the target workbook opens. This password msgbox is visible instead of
hidden when the first workbook is opened up.)

Thanks for any help on this. I'm sure others have run into this but
it's a difficult one to phrase on a search engine.

Tomu
 
A

Arvi Laanemets

Hi

Set the visible property for them to False in Workbook's Open event (In
VBAProject, right-click on ThisWorkbook object, select View Code, and select
Workbook in leftmost dropdown at top of code window - an empty Open event is
inserted automatically)
 
T

Tomu

Thanks Arvi,

That's just the right direction I needed pointing in. Did the trick!

Now, if you or anyone else can recommend a well written tutorial
online that explains basics of VBA in Excel that might keep me from
posting these simplistic queries in the future.

Thanks again,
Tomu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top