KeyserSoze
Programmer
I have a subroutine that e-mails the active workbook by pulling up the SendMail dialog box. However, after the user hits send, the following error is produced:
Run-time error '91';
Object variable or With variable not set
Here is the routine:
----------------------------------------------
Sub SendToEmployee()
Dim Result As Dialog
'
' First check and see if the user has saved the workbook.
'
If ActiveWorkbook.Saved = False Then
MsgBox "Your workbook must be saved before you can e-mail it to the employee!", vbOKOnly + vbExclamation, "Send Review to Employee"
Exit Sub
End If
Result = Application.Dialogs(xlDialogSendMail).Show
If Result Is Nothing Then
Exit Sub
Else
ThisWorkbook.CustomDocumentProperties("HDFS State").Value = "Employee"
MsgBox "Performance review has been sent!", vbOKOnly, "Send Review to Employee"
ActiveWorkbook.Close
End If
End Sub
----------------------------------------------
If the user clicks the Send button on the mail dialog box, I want to set a custom property. If the user does not send the e-mail, I want to exit the subroutine. I am using Excel 2002 and Outlook 2002.
Thanks!
Run-time error '91';
Object variable or With variable not set
Here is the routine:
----------------------------------------------
Sub SendToEmployee()
Dim Result As Dialog
'
' First check and see if the user has saved the workbook.
'
If ActiveWorkbook.Saved = False Then
MsgBox "Your workbook must be saved before you can e-mail it to the employee!", vbOKOnly + vbExclamation, "Send Review to Employee"
Exit Sub
End If
Result = Application.Dialogs(xlDialogSendMail).Show
If Result Is Nothing Then
Exit Sub
Else
ThisWorkbook.CustomDocumentProperties("HDFS State").Value = "Employee"
MsgBox "Performance review has been sent!", vbOKOnly, "Send Review to Employee"
ActiveWorkbook.Close
End If
End Sub
----------------------------------------------
If the user clicks the Send button on the mail dialog box, I want to set a custom property. If the user does not send the e-mail, I want to exit the subroutine. I am using Excel 2002 and Outlook 2002.
Thanks!