PDA

View Full Version : Making TextBoxes or Charts Disappear



cyrus3
02-18-2008, 09:34 AM
Hi everyone,

I am trying to make a textbox disappear and reappear, preferably initiated by the click of a button. My goal is to have an "explanation" appear for a given scenario at the click of said button, and disappear when clicked on again.

I'm talking about the textboxes that are (text) formattable. Regular textboxes for Excel. You can assign macros to them, but they have no easily identifiable properties, or (name).

If anyone could steer me in the right direction, would be much appreciated.

Thanks

Cyrus

Bob Phillips
02-18-2008, 09:48 AM
Are you talking about textboxes on a userform, or on a worksheet from the control toolbox?

cyrus3
02-18-2008, 09:56 AM
I'm talking about the textboxes you create using the "Drawing" toolbar.

thx

Bob Phillips
02-18-2008, 10:13 AM
Put this code in a macro and assign it to the button



With ActiveSheet.Shapes("Text Box 1")
.Visible = Not .Visible
End With

cyrus3
02-18-2008, 11:03 AM
Frickin' perfect.. let me play around a bit with it. I might (probably will) have other questions. But let me learn as much as I can using this. Thx very much, frickin' perfect.

Here are two of my personal latin favorites... Sol Tuus Asinus Lucit & Stercore Ambulat et Pecunia Narrat.

Bob Phillips
02-18-2008, 11:27 AM
Not nice :-)

cyrus3
02-18-2008, 12:41 PM
Dude, I have to go back to the well. I'm made the thing work on a brand new Excel doc. But when I try to put it in my current project it refuses to work.

It highlights
With ActiveSheet.Shapes("Text Box 1")

And says there is a problem? Any thoughts on why that might be? If you need more information, let me know. And thx in advance.

Bob Phillips
02-18-2008, 12:46 PM
The shape is probably called something else. Select it and see what it says in Names box.

cyrus3
02-18-2008, 12:52 PM
Right on dude.. Thx big time.

Per aspera ad astra

Bob Phillips
02-18-2008, 02:02 PM
Did you know that that is the motto of the Royal Air Force and of Kansas (well in reverse)?

cyrus3
02-25-2008, 10:48 AM
Dude! Good morning. I have to go back to the well..

All this stuff affecting a textbox is pretty new to me, sorry. But how do I refer to it (the textbox) on its own? For instance, at the close of the program I want the default to be that the textbox is invisible... soo what I have is this:

Private Sub WorkBook_BeforeClose(Cancel As Boolean)
ActiveSheet.Shapes("Text Box 1").Visible = False
End Sub

But it doesn't work. Any thoughts? Thx.

And to answer your question.. Didn't know that. I feel like the knowledge street is one way here right now. Hmm.. I'll have to see if I can remember another latin saying.. I know Ad Mare Usque ad Mare (something like that) I think, Canada's motto?

Bob Phillips
02-25-2008, 11:01 AM
Afternoon!

If the shape is called Text Box 1, and its sheet is active, your code should work fine.

As to the Latin, I didn't know that, but it has to be A mari usque ad mare ... FROM sea TO sea ...

Actually, I just looked it up, and I find that there are moves afoot in Canada to change it to From sea to sea to sea, to include the Arctic. The French version for it is 'D'un ocean ? l'autre', which just sounds so muc better to me.

cyrus3
02-26-2008, 07:15 AM
Yo Xld,

Sorry I didn't reply yesterday. I was trying some different things out when the power went out at work. Didn't come back till just before 5. The Before Close thing isn't working but I will play around with it for a while.

cyrus3
02-26-2008, 08:07 AM
Xld! I think I've figured it out! I'm just learning to differentiate between the "WorkBook" Zone, the "WorkSheet" Zone etc. Its going better.. gotta work some more.

Ohhh, I just remembered another one. This is my favorite one. Melius Frangi Quam Flecti! That is my favorite latin saying.