I am trying to configure this code so that the workbook can be saved when its reset regardless of whether the user employs Excel 2003 or Excel 2007. We have both users in our office.

Runs OK in 2007 but when I try to run it through 2003, I get a compile error: Variable Not Defined referring to xlOpenXMLWorkbookMacroEnabled. If I Dim xlOpenXMLWorkbookMacroEnabled as a variable in 2003 to avoid the error, the macro works in 2003, but not in 2007.

How can I rewrite this to make both versions happy?

[vba]Sub RESET_OAI_Wkly()
'On Error GoTo HandleErrors
Dim answer As String, rLName As Range, rMoYr As Range, fname As
Variant
Dim xlOpenXMLWorkbookMacroEnabled

Worksheets("NAME & ID INFO").Activate
Set rLName = Range("A107") 'Last name
Set rMoYr = Range("A109") 'Month and year

'Creates a new workbook, renames it, then clears out the old data
If MsgBox("You are about to create a new workbook for the next month." _
& vbCrLf + vbCrLf & "Your old workbook has already been saved." _
& vbCrLf + vbCrLf & "In this step, Excel will provide a recommended " _
& "file name as: MAR LastName BeginDate. " & vbCrLf + vbCrLf & _
"Are you ready to proceed?" & vbCrLf + vbCrLf, vbYesNo + vbCritical _
+ vbDefaultButton2, " NEXT STEP") = vbYes Then

'Procedure if saving in Excel 2000-2003
If Val(Application.Version) < 12 Then
fname = Application.GetSaveAsFilename _
(initialfilename:="OAI_MAR " & rLName & " " & rMoYr, _
filefilter:="Microsoft Excel Workbook (*.xls), *.xls")
If fname <> False Then
ActiveWorkbook.SaveAs Filename:=fname
End If
End If

'Procedure if saving in Excel 2007
If Val(Application.Version) = 12 Then
fname = Application.GetSaveAsFilename _
(initialfilename:="OAI_MAR " & rLName & " " & rMoYr, _
filefilter:="Microsoft Excel Workbook (*.xlsm), *.xlsm")
If fname <> False Then
ActiveWorkbook.SaveAs Filename:=fname, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End If
End If

'Continue with clearing out old data
answer = InputBox("You've created and named the new workbook." _
& vbCrLf + vbCrLf & "If you're ready to clear out the old data, " _
& " type the word YES below:" & vbCrLf + vbCrLf & "Be sure to use " _
& "UPPERCASE letters", " CONFIRMATION")
If answer = "YES" Then
KeepMy11
Eraser2
ClearAll
End If
If answer = "yes" Then
If MsgBox("Be sure to type YES in all uppercase letters.", _
vbRetryCancel + vbInformation, "Type Response in Capital " _
& "Letters") = vbRetry Then
answer = InputBox("You've created and named the new workbook. " _
& "If you're ready to clear out the old data, type the word " _
& "YES below:" & vbCrLf + vbCrLf & "Be sure to use UPPERCASE " _
& "letters", " CONFIRMATION")
If answer = "YES" Then
KeepMy11
Eraser2
ClearAll
End If
End If
End If
End If
Set rLName = Nothing
Set rMoYr = Nothing

'HandleErrors:
Application.EnableEvents = True
End Sub[/vba]
Ron