Hi all,
I have this workbook used by many people as a dashboard ; when I need to update it, I usually ask they close their files (only a few PCs), but it's going to be expanded, and that's not something I'll be able to do anymore.
So I tried to force the opening to Read Only, but it isn't handy as it requires a Yes, and I believe it will fly over the head of way too many people. For now, I'll leave it like this, but I tried to go through VBA, with this little bit :
file_path = "W:\filepath.xlsm"
Set my_wb = Workbooks.Open(fileName:=file_path, ReadOnly:=True)
As is, it works, but I have several other code running at start/open of the file, and the application of the Read Only status overrides some of them it appears, specifically the hiding of the ribbons.
I've tried working around putting the code on Activation, but it didn't work out. How could I integrate it properly ?
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub
'Cache le ruban ? l'ouverture du Kiosk, ou lorsqu'on met le focus dessus ; cette option ne s'applique qu'? lui.
Private Sub Workbook_Activate()
Application.ScreenUpdating = False
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = Not Application.DisplayStatusBar
ActiveWindow.DisplayWorkbookTabs = False
Application.ScreenUpdating = True
End Sub
'Affiche le ruban ? la fermeture du Kiosk, ou lorsqu'on en quitte le focus ; cette option ne s'applique qu'au Kiosk.
Private Sub Workbook_Deactivate()
Application.ScreenUpdating = False
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_Open()
Dim my_wb As Workbook
Dim file_path As String
Sheets("Kiosk").Visible = True
Sheets("Support").Visible = False
Sheets("Divers").Visible = False
Sheets("Other").Visible = False
Sheets("Other2").Visible = False
Sheets("Templates").Visible = False
Sheets("addresses").Visible = False
Sheets("Test").Visible = False
Sheets("Classified As UnClassified").Visible = False
Sheets("Other3").Visible = False
Sheets("Quotes").Visible = False
Sheets("LinkCheck").Visible = False
Sheets("Repair").Visible = False
ActiveWindow.Zoom = 85
file_path = "W:\filepath.xlsm"
Set my_wb = Workbooks.Open(fileName:=file_path, ReadOnly:=True)
End Sub
Bookmarks