Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch form from object in excel

Status
Not open for further replies.

ckhunley

Technical User
Jul 26, 2004
33
0
0
US
I have a series of forms to carry out various tasks in an excel workbook. I am trying to figure out the best way to start the first form. I am thinking a button of some sort from Excel, but am not sure how to do it. I don't want it to start automatically when the workbook is opened, I want it to be user initiated.

Thanks,
Chris
 
Easy.

If you'd like to do it from a Command Button, simply put this line in the Click event:

FormName.Show



*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
I put a command button in excel, and added that code...but it won't allow me to click on it. It always selects the button instead of clicking. I assume there is a property that I need to change or something like that, but I have no idea what it is...
Thanks,
Chris
 
Hehe...

You're in design mode. In the Control Toolbox, click the green/blue triangle. This places you in and out of design mode.

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Nevermind, I just figured it out, needed to exit design mode...Thanks anyway though
Chris
 
Just a possibility you are still in design mode from the control toolbox

Look for the set square and pencil symbol and make sure its off/risen not sunken.

Hope this helps

Neil
 
Looks like all three of us found the answer at once...well you two knew it, I had to find it. Is there a way to hide the button once it has been clicked? It didn't like the commanbutton1.hide command.
Thanks,
Chris
 


CommandButton1.Visible = False


Put it BEFORE the UserForm1.Show command, as the line won't run until the focus is set back on the sheet.

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Ok, so now that my command button has been clicked, it went invisible. Now I am having trouble getting it back. I have the following:

Public Sub Workbook_Open()
startcalcs.Visible = True
End Sub

It is in the module for the worksheet which displays the button, but no matter how many times I have closed and opened the workbook, nothing happens. I tried placing it in the module for the workbook, but that hasn't worked either. Any help?
Thanks,
Chris
 
From the Workbook Module, you need to reference the sheet name.

Sheet1.Commandbutton1.Visible = True

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top