Hello
the macro in Private Sub Workbook_BeforeClose to the close inserts the writing in the enabled sheets:
"you need to enable macros to view this workbook"
"devi attivare le macro per visualizzare questo workbook"
when the workbook starts, if the macros are activated the word disappears.
Is it possible that at the end of the workbook the writing does not appear but only at startup and then disappears if the macros are activated?
I hope I have explained.
john
the macro in Private Sub Workbook_BeforeClose to the close inserts the writing in the enabled sheets:
"you need to enable macros to view this workbook"
"devi attivare le macro per visualizzare questo workbook"
when the workbook starts, if the macros are activated the word disappears.
Is it possible that at the end of the workbook the writing does not appear but only at startup and then disappears if the macros are activated?
I hope I have explained.
Code:
Option Explicit
Private Sub Workbook_Open()
Dim nomefoglio As Variant
Dim Urec As String
'-------------------------------------------
'se non attivate le macro il workbook resta bloccato
Dim fogli As Worksheet
Application.ScreenUpdating = False
'For Each fogli In Worksheets
For Each fogli In ThisWorkbook.Sheets
If fogli.Name <> "AA" And fogli.Name <> "BB" And fogli.Name <> "CC" And fogli.Name <> "DD" Then
fogli.Unprotect "987654"
fogli.Range("E1:H1").ClearContents
fogli.Unprotect "987654"
End If
Next
Application.ScreenUpdating = True
'-------------------------------------------
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nomefoglio As Variant
Dim Urec As String
'-----------------------------------------------
'se non attivate le macro il workbook resta bloccato
Dim fogli As Worksheet
Application.ScreenUpdating = False
'For Each fogli In Worksheets
For Each fogli In ThisWorkbook.Sheets
If fogli.Name <> "AA" And fogli.Name <> "BB" And fogli.Name <> "CC" And fogli.Name <> "DD" Then
fogli.Unprotect "987654"
fogli.Range("E1:H1").Value = "devi attivare le macro per visualizzare questo workbook"
fogli.Protect "987654"
End If
Next
Application.ScreenUpdating = True
'-----------------------------------------------
End Sub
john