0
votes

I have a Workbook by name "archive" which I am hiding. When opening the workbook, a UserForm pops and asks for password. If the correct password is entered another form opens. The problem is that when the password form opens after clicking on the workbook, I cannot open any other workbook. It seems like all workbooks are hidden and they only open if I enter a password. The code I use is:

Private Sub commandbutton2_click()

If TextBox1.Value = "Secret" Then
    MsgBox "Welcome", vbExclamation, "Access granted"
    Me.Hide
    UserForm1.Show
Else
    MsgBox "You have entered an incorrect password!"
    Unload Me
End If

End Sub
1
do you have a UserForm_Initialize() for the first userform? if yes then what do you have in itArun Thomas
At a guess, the Workbook_Open event is showing the password form modally, but that's just a guess since you didn't show enough code to reproduce the issue.Tim
Thank you Shai for you time and assistance,Mbarack Saeed
I downloaded a template which i edited to suit my needs. I have this Code in Module 1 Sub auto_open() Application.Visible = False UserForm2.Show End SubMbarack Saeed
My apologies, I am not good in english.Mbarack Saeed

1 Answers

0
votes

you have to use the vbModeless modal

that is, change your code

Sub auto_open()
    Application.Visible = False
    UserForm2.Show
End Sub

to

Sub auto_open()
    Application.Visible = False
    Windows("archive").Visible = False
    UserForm2.Show vbModeless
End Sub

this will allow you to open other workbooks