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

userform

Status
Not open for further replies.

bencnu

Technical User
Nov 3, 2003
34
US
I have to questions.
When i have a user form open on one of my woorkbooks why can't i switch to a different workbook?
How do you use vb to close a workbook?
Thanx :)
 
Hi bencnu!

Not many people still in here today - all headed off to relatives houses for Thanksgiving, no doubt. . .

When a Userform is open, Excel acts just like it does when a Sub is running, thus ignoring user input outside the form. You can, however, activate another open workbook via code, using something like:
Code:
Workbooks("MyWorkbookName.xls").Activate
As far as closing a workbook, it's very easy as long as it isn't the workbook that the VBA is in (and nearly impossible if it is!). You would use:
Code:
Workbooks("MyWorkbookName.xls").Close
Hope that helps!

VBAjedi [swords]
 
If you change the Properties for the Userform, field ShowModal, from True to False, then the form will remain while you switch windows. Form will remain displayed until you use the Unload event activated from an action such as clicking an OK Button.
 
....bump....
I still can't figure this out...
Any help would be awesome! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top