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

Locked out by userform---- help

Status
Not open for further replies.

loydlr

Technical User
Mar 4, 2002
34
RU
I've gotten myself into a fine mess here. I have a very large spreadsheet that I've been working on for a couple weeks now. I was trying to use a userform to show certain sheets based on a user login. I know nothing about vba so I've been reading and getting snippets here and there. What I ended up doing was creating a userform which runs when the spreadsheet opens. The really dumb part is I was experimenting and have no way to close it. To make matters worse, I have disabled the "x" close button on the form. Now the spreadsheet opens with the userform front and center. I cannot close it, therefore I cannot get to any of the data. I cannot get to the vba window either to delete the code that disables the close button. Any help would be greatly appreciated.
 
I can not assist you in your overall problem, but remember Alt+F4 will close the active window. So if that userform is the top active page, it should close....

Tom
 
It doesn't work. The code that I used to disable the "x" button apparently traps this also.

Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
End Sub

I appreciate your response though.

Loyd
 


Hi,

What's the entire purpose of the userform? Too often, IMHO, forms of this kind get in the way of the user.

Does the user need to get to a SHEET? Right-click in the lower left-hand corner in the
[tt]|< < > >|[/tt] sheet navigation arrows.

Skip,

[glasses] [red][/red]
[tongue]
 
Basically a login window. Certain sheets would be made visible based on a username and password. It is actually not needed at all and does get in the user's way. At this point I would like to make it all go away, but I am stuck. I cannot get to the data because of the userform. If I could just get around it I would remove it completely.


Loyd
 
Is there some way to open the spreadsheet without executing the code in the workbook's open event?
 
try pressing SHIFT when opening the spreadsheet.

In Access, this will defeat an autoform. I'm not sure if it would have the same result in Excel.


Tom
 
No dice...
Thanks for the suggestion Tom.

Loyd
 



Once the user logs in, use the HIDE method of the userform object.

Skip,

[glasses] [red][/red]
[tongue]
 
Skip,

The problem is that I never completed the userform. The buttons on it have no code behind them. I realize it was a really dumb thing to do, but it's done and I can't figure out how to get around it.
The userform cannot be closed either by the "x" button or by any controls on the form. The userform has the focus and I can't bypass it.

Loyd
 
I can't...
I've tried to get to the vba window, but the userform has the focus and I can't do anything. Tried opening additional spreadsheets to see if I could get to the form by using a different workbooks vba window, but as long as the userform is open it has the focus and I can do nothing else in excel.


Loyd
 
I would have never even thought of that... Thank you very much Skip
Problem solved.

Loyd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top