B
Brad
Thanks for taking the time to read my question.
I'd like to make a button on my tool bar in Outlook 2007 that will
automatically save the selected e-mail to a predetermined folder. This is
the code I have so far for my macro, but it doesn't work. I get the error
Run-time error '91':
Object variable or With block variable not set
code:
Public Sub ExportSAR()
Dim TheEmail As MailItem
Dim NewFileName As String
NewFileName = InputBox("Enter the SaveAs name", "Save E-mail As", "SAR -
Change - ")
If NewFileName <> "" Then
TheEmail.SaveAs "A:\2009\200907\" & NewFileName, olMSG
Else
MsgBox "No file name was entered. Operation aborted.", 64, "Cancel
Operation"
Exit Sub
End If
End Sub
I can't figure out what I need to fix to make this work. Any help would be
great.
Thanks,
Brad
I'd like to make a button on my tool bar in Outlook 2007 that will
automatically save the selected e-mail to a predetermined folder. This is
the code I have so far for my macro, but it doesn't work. I get the error
Run-time error '91':
Object variable or With block variable not set
code:
Public Sub ExportSAR()
Dim TheEmail As MailItem
Dim NewFileName As String
NewFileName = InputBox("Enter the SaveAs name", "Save E-mail As", "SAR -
Change - ")
If NewFileName <> "" Then
TheEmail.SaveAs "A:\2009\200907\" & NewFileName, olMSG
Else
MsgBox "No file name was entered. Operation aborted.", 64, "Cancel
Operation"
Exit Sub
End If
End Sub
I can't figure out what I need to fix to make this work. Any help would be
great.
Thanks,
Brad