A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Save e-mail to .msg file



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old July 17th 09, 07:31 PM posted to microsoft.public.outlook.program_vba
Brad
external usenet poster
 
Posts: 78
Default Save e-mail to .msg file

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
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save a email, sent out, as a file DPM Outlook and VBA 4 December 11th 07 05:46 AM
mshtml.Help file is missing. Can't save E-Mail pictures. Andy Outlook Express 10 October 18th 07 03:02 AM
How to automatic save file and forward mail? Mesak Outlook and VBA 1 July 26th 07 03:54 PM
outlook 2k3 Script: how to Save Mail body to txt file news.microsoft.com Outlook and VBA 5 November 7th 06 02:23 PM
trying to save as .msg file !! WhytheQ Outlook and VBA 2 May 26th 06 01:32 PM


All times are GMT +1. The time now is 06:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.