View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_21_] Stuart[_21_] is offline
external usenet poster
 
Posts: 154
Default Userform Question - is this possible?

Confirmation it seems "do-able" ..... Thanks.
A sample structure to get me started... Thanks again.

Regards.

"Shawn O'Donnell" wrote in message
...
"Stuart" wrote:
I would like to show a userform, force certain textboxes
to be filled, then permit user to "Save".
"Save" would:

<snip

All of that seems doable. You might do things in a slightly different
order:

1. Export the form
2. Prompt for the name of the new Workbook, then create it.
3. Import the form into the new Workbook.
4. Copy the control settings from the old form to the new form.
5. Mess with the code in the new Workbook.

You can export the form with something like this:

Workbooks("Book1.xls").VBProject.VBComponents("Use rform1").Export
("temp.bas")

and import it with

Workbooks("Book2.xls").VBProject.VBComponents.Impo rt ("temp.bas")

You can be more specific about the file path, etc.

Export/Import preserves the layout & code of the form, but not its state.

Looping through the controls collection to copy control states is a little
tedious because each type of form has its own properties.