Hey guys,
Just ran into an issue trying to run my code to restore a user's environment settings to what they were before I started my macro. Code is here:
The code fails on the line that sets the calculation back if there isn't at least one workbook showing in the Excel window. Anyone know some quick code to drop in there to ensure at least one workbook is open? I'd do it, but I don't have time to look for it right now.Option Explicit Dim xlCalcState As Long Sub Environ_RestoreSettings() 'Macro created 06/11/2005 22:33 by Ken Puls 'Macro Purpose: To restore application properties to user settings 'Restore screen updates, clear statusbar and set 'calculation back to user's initial setting With Application .ScreenUpdating = True .DisplayAlerts = False .Calculation = xlCalcState .StatusBar = False End With 'Set the calculation state variable to 0 xlCalcState = 0 End Sub
Thanks!