Controlling "Options" in a macro

B

Brad

When the user starts up a particular workbook I want to force the following
to false

.ShowStartupDialog
.DisplayFormulaBar
.DisplayStatusBar
.ShowWindowsInTaskbar

When the user closes the document I want the previous information reset to
it's original status.
 
E

excelent

Put in ThisWorkbook

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ShowStartupDialog = True
Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True
Application.ShowWindowsInTaskbar = True
End Sub

Private Sub Workbook_Open()
Application.ShowStartupDialog = False
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
Application.ShowWindowsInTaskbar = False
End Sub



"Brad" skrev:
 
B

Brad

How about the condition where two are true and two are false?

Said different how do you capture the information whether the conditions are
true or not.
 
E

excelent

this return actual setting:

msgbox("") & Application.ShowStartupDialog

"Brad" skrev:
 
E

excelent

Just read now ur question "previous information reset to it's original
status. "
one way is to write status to a range - change range to what u prefer
Just remember to write True or False manualy befor close sheet next time
but only this time. in future the macro do the job.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ShowStartupDialog = Sheets("Sheet1").Range("A1")
Application.DisplayFormulaBar = Sheets("Sheet1").Range("A2")
Application.DisplayStatusBar = Sheets("Sheet1").Range("A3")
Application.ShowWindowsInTaskbar = Sheets("Sheet1").Range("A4")
End Sub

Private Sub Workbook_Open()
Sheets("Sheet1").Range("A1") = Application.ShowStartupDialog
Sheets("Sheet1").Range("A2") = Application.DisplayFormulaBar
Sheets("Sheet1").Range("A3") = Application.DisplayStatusBar
Sheets("Sheet1").Range("A4") = Application.ShowWindowsInTaskbar

Application.ShowStartupDialog = False
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
Application.ShowWindowsInTaskbar = False
End Sub


"excelent" skrev:
 
Top