Hi Dave!
This macro should work for you...
Sub saveFile()
Dim lastName, employeeID, projCode, auditorID As String
Dim saveDate, newFileName As String
'Prompt user for ID & initials...
employeeID = InputBox("Enter employee ID: ")
auditorID = InputBox("Enter Auditor initials: ")
' Get last name...
lastName = ActiveSheet.Range("A1").Value
' Get project code...
projCode = ActiveSheet.Range("B2").Value
' If all variables are present, create new file name based on variables and save it w/new name...
If employeeID <> "" And auditorID <> "" And lastName <> "" And projCode <> "" Then
saveDate = CStr(Format(Now(), "m.d.yy"))
newFileName = lastName & " (" & employeeID & ") " & projCode & " " & auditorID & " " & saveDate & ".xls"
' Save file as new file name...
ActiveWorkbook.SaveAs Filename:=newFileName, FileFormat:=xlNormal
Else
' Otherwise, data is missing for new file name so alert user...
MsgBox ("Can't save file; required data is missing.")
End If
End Sub
Hope this helps,
theDude
Bookmarks