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

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

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