Show UserForm in New Workbook

devilishblueyes

New Member
Joined
Oct 18, 2007
Messages
18
Here's where I'm at...

I initially show UserForm1 in the window for Book1. The user enters values into the textboxes of UserForm1 then clicks CommandButton1. The subroutine for CommandButton1 checks that the active workbook is the correct form. If not, it opens a new workbook using Workbooks.Add and it creates a new workbook called Book2 from a template.

Here's my problem...

UserForm1 is still being shown in the Excel Window for Book1. I want UserForm1 to now be shown in the Excel Window for Book2.


Currently if I activate Book2, UserForm1 is now hidden away in the window for Book1. If I show UserForm1, then the window for Book2 is now hiding below the window for Book1. And I'm wanting to avoid closing UserForm1 so that I don't lose the values in the textboxes.

Is there anyway I can change the window that UserForm1 is displayed in from Book1 to Book2 without losing the values in the textboxes?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
In the scenario in which Book1 is not in the correct form and Book2 is opened, what do you want to do with Book1?
 
Upvote 0
In that scenario, I want to leave Book1 completely alone and do nothing to it because that may be a totally different kind of file that the user most likely does not want to change at all. So my thought would be to leave Book1 open and do nothing to Book1, add Book2 change the focus of the program completely to Book2, make the changes to Book2 and finish up with Book2 as the active Excel window and with UserForm1 open in the Book2 window with all of the values entered on the form still entered on the form. My UserForm is pretty complex and it has Click and Change events associated with some of the combo boxes and text boxes. So I'm trying to avoid capturing all of the form values, Unloading the form, activating Book2 then reloading UserForm1 and repopulating the values of all of the UserForm1 objects which would likely trigger event procedures.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,517
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top