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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a windows with buttons! 2

Status
Not open for further replies.

colinmitton

Technical User
Feb 24, 2005
190
GB
I'm new to VBA and using office 2003 (Word). I need to create a window of which I can press buttons on to pull up templates from our template area, various print functions, and other tools. The window if possible needs to have multipal tabs!

I've used marco's to create buttons on the tool bars but its getting very clogged up with custom buttons now!

Any help would be greatly received.

Thanks
Colin
 
In Word,
hit Alt-F11
In Project Explorer, right click on Normal,
choose Insert.... - User Form

This will give you a basic Form and some controls in Toolbox. You will have a Label control already there. If you need to add a tab control, right-clik on an empty area in Controls, choose Additional Controls... find Miscrosoft Tabbed Dialog Control.

You may want to try TabStrip as well.

HTH

---- Andy
 
Thanks for that, a few more questions though....

How do I get the window in to word its self? (i.e. run it from a button on the toolbar).

I have created three tabs but the button I have created on tab 1 appears in the other two, how do I assign a button to the relevent tab / page (I'm guessing I've missed something here!).

Thanks I'm sorry to be such a pain but its all very new to me!!

Colin
 
You have to be very careful to place your controls on the Tab, and not on the Form itself. Click on the Tab, this makes Tab control appear to have the little white squares for you to resize it. And when you have that – place your other control(s) on the Tab. Hint – if you move Tab control, all controls on that Tab should move as well with it.

To run it from the button on the toolbar – I guess you just need to say in your code: UserForm1.Show (userForm1 or whatever you named it)

---- Andy
 
went back to the beginning and used a Multipage on the userform, worked spot on!! I have now set it up to run from a button in word and everything is going!!

I do have another few questions but I will post a new questions for those. but on this one once I have pressed a button how do I automatically close the form? My toolbars dont appear correctly on the new window until the form is closed?

Ta, this is going to make life a lot easier!!

Colin
 
I am not really following this. It may be the use of the term "window". I am not following where the buttons are, and what they are doing. I am not following what is happening with the toolbars. I am not following what is the "new" window.

In any case, you unload a userform by using the Unload instruction.

You should probably also look at Show and Hide in Help. I am not following if you are trying to Hide the userform, or actually unload it.

Gerry
My paintings and sculpture
 
Sorry, by the term "window" I mean the form with tabs that I have just created.

I have been looking through help but under the terms of Close and Exit not Hide! I have given that a go and it works like a dream!.

Sorry for my lack of knowledge on this, at some point i must really do a course or something! I have never really had any need until now.

Thanks again for all the help.

Colin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top