ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide sheets and allow form (https://www.excelbanter.com/excel-programming/430274-hide-sheets-allow-form.html)

Alain R.

Hide sheets and allow form
 

Hi,

When my user open the XLS file, i would like to be sure that all sheets
are hidden and that a particular form is displayed.
this form should be somehow modal to be sure that user can not click on
Excel application menu or somewhere else.

how can i do that ?

thx.

A.

Patrick Molloy

Hide sheets and allow form
 

first off you'll need at least one visible sheet
next, make all the other sheets xlhidden or xlveryhidden

Sub HideSheets()
dim ws as worksheet
for each ws in worksheets
if ws.name < "Sheet1" then
ws.Visible = xlveryhidden
end if
next
End Sub

show the userform from the workbook's open event
to do this, go to the development environment (ALT+F11), then in the project
view right click on ThisWorkbook and select View Code
In the code sheet, select Workbook from the object dropdown - you'll see
<General by default
- and you'llprobably get the Open methods SUB/END SUB stubs entered by
default
add the show userform code as per this example:

Private Sub Workbook_Open()
UserForm1.Show
End Sub


"Alain R." wrote in message
...
Hi,

When my user open the XLS file, i would like to be sure that all sheets
are hidden and that a particular form is displayed.
this form should be somehow modal to be sure that user can not click on
Excel application menu or somewhere else.

how can i do that ?

thx.

A.




All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com