Open Userform in different workbook

Endorphin

Board Regular
Joined
Oct 27, 2006
Messages
62
Hi All,

I have two workbooks, both completely userform driven, the user does not get to see the worksheets at any stage.

What I am trying to do is swap workbooks via the userforms so clicking a command button opens up the second workbook and Userform and saves the original one.

I have the code to automatically open the userform when the work book is loaded but it does not seem to work while swapping, however it does work when used individually.

Any help appreciated.

Neil
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
What code are you using to automatically load the other form - Auto_Open or Workbook_Open?
 
Upvote 0
OK, so what code are you using to open the second workbook? (I assume you haven't set EnableEvents to False somewhere?)
 
Upvote 0
Hi Rory,
No have not set any EnableEvents commands

Im using : Workbooks.Open "C:\Status Logs\Picc.xls" to open the second workbook

Neil
 
Upvote 0
That should work. Have you tested to see if the Open event in the second workbook is being called?
 
Upvote 0
Hi Rory,

Solved, but not sure how.
I cut all the WorkBook_Open code and pasted it into a text document then tried it with application run after opening the book, then put the Open code back in and it worked, really have not idea why.

I spent 4 hours trying to get it to work yesterday, and changed no code...lol

Thanks for trying to help and sorry to have wasted your time.

Neil
 
Upvote 0
No worries - at least it's working!
If I were you though, I'd run code cleaner on the workbook just to clear out any p-code garbage.
 
Upvote 0
This, and yes. :)
Note: you can achieve the same thing by hand by exporting all the code, removing the modules and reimporting the code.
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,442
Members
448,898
Latest member
drewmorgan128

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