Controlling "Options" in a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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:
 
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.
 
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:
 
Back
Top