Sub SaveAll()
' Store the Activeworkbook in a variable.
Set aw = ActiveWorkbook
For Each wb In Workbooks
If wb.Path <> "" Then ' Save file if it has been saved
' previously
wb.Save
Else ' If not previously saved, activate and show the
' Save As dialog box.
wb.Activate
Application.Dialogs(xlDialogSaveAs).Show
End If
Next
aw.Activate ' Activate the original Activeworkbook.
End Sub