If userform is already open then MSG box to open saying Userform in Use

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi I am trying to put a code together into a command button which opens the userform1, but if someone else has the userform open already I want a msgbox pop up to say that ‘userform is in use’, I have put the following code togetherbut getting no joy. Hope you can help?

Code:
Private Sub CommandButton1_Click()
ThisWorkbook.Save
UserForm1.Show
If CurrentProject.AllForms("UserForm1").IsLoaded = False Then
     ' Form is closed
Else
     MsgBox "userform is in use"
     ' Form is open
End If

End Sub
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
What do you mean by "if someone else has the userform open already"? Userform instances are specific to the excel application instance, so someone else can't have the same userform open.
 
Upvote 0
Hi I would have workbook shared . And if a user is in userform then to notify the other person
 
Upvote 0
Not directly. You'd need to log the fact the userform is open in say a text file in a location accessible to both users (eg a network folder) and then check for that file in the form's Initialize event.
 
Upvote 0
wow that sounds tricky, is there a way to share the workbook (userform) so all users can update at the same time?
 
Upvote 0

Forum statistics

Threads
1,224,743
Messages
6,180,686
Members
452,994
Latest member
Janick

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