PDA

View Full Version : Solved: userform as a template



chrisatleo
04-11-2005, 05:57 AM
Having just started to use VBA, is it possible to save a userform as a template to be reimported and changed as needed (in Word)?

I have to design a menu structure where a main menu calls a submenu which calls another or executes a procedure etc (at least, I hope it will, when I have found out how to do it!). The button layout and image background of the menu remains largely the same, just the command buttons will change in name and function.

I have tried to export the form and reimport but as I have read elsewhere, there is an import issue. So I renamed the original form (from, say, Master to Child) before exporting, exported it, then restored the original (Master) name - all ok so far

I can import the (Child) form again, as it has a different name, but it won't let me change the name (Child) to anything else to create a new one.

Am I doing this wrong? It will be a bit tedious to have to create about 20 userforms manually.

Thanks

Christopher Lovelock

Steiner
04-11-2005, 07:34 AM
I'm not sure if I understood your procedure right, but I tried it that way with Word97 and had no problems:

- create Form1
- export Form1
- rename active Form1 to Form2
- import Form1
- rename active Form1 to Form3
- import Form1
...
Do you use another method?

chrisatleo
04-11-2005, 09:46 AM
No exactly that, I have no idea what happened except that when I imported the form it came up titled UserForm1 not the name I had exported it under.

Since I posted this I have played some more and successfully changed the form name to UserForm2, after which I was able to change it to the name I wanted.

So I have no idea what the issue was but I think I have solved it, so lets mark this post as solved, and thanks for the help! Guess it was finger trouble!

Steiner
04-11-2005, 10:54 PM
The name you give the file when you export it, has nothing to do with the form name. That will be the name it had when you exported it.

You can mark that thread as solved yourself. Have a look at the thread tools menu right on top of your first posting.

Daniel