Link to home
Start Free TrialLog in
Avatar of pg1533
pg1533

asked on

ThisWorkbook.Windows(1).Visible = False

Hi,

I have a form named 'LoginFrm' in the workbook named 'Forecast.xlsm'. I have written the below code in workbook_open() event.

 Private Sub Workbook_Open()

ThisWorkbook.Windows(1).Visible = False
LoginFrm.Show

End Sub

Open in new window


This will disable the user to access the worksheets which are there in this workbook. However, if there are already workbooks open (i am referring to other workbooks) then when I open this workbook (Forecast.xlsm) then this code will disable the user in accessing other opened workbooks also. Ideally, the user should be able to access other workbooks other than 'Forecast.xlsm'. Please advise.

Thank you,
Prashanth
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

It might be because all the workbooks are in the same instance and share the same window.
EE's sister site online-tech-tips has a registry patch for creating multiple instances in this article:

http://www.online-tech-tips.com/ms-office-tips/how-to-open-a-new-instance-of-excel-2007-workbooks/

Or there is discussion in a recent question here:

https://www.experts-exchange.com/questions/28070937/Open-up-individual-Excel-windows.html
Instead of making the windows not visible why not set all tabs to xlVeryHidden and then once the user has logged on then loop through and make them visible. You would also add a before save script to hide them before the workbook is saved.

Michael
ASKER CERTIFIED SOLUTION
Avatar of Michael Fowler
Michael Fowler
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pg1533
pg1533

ASKER

Thank you