See if the file name you end up with has any illegal characters in it. See
if you can save the same item yourself manually, to see if that works.

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

"Chris" <Chris@discussions.microsoft.com> wrote in message
news:C7994A49-C95B-4D0F-BF02-A2AEB97EBA13@microsoft.com...
>I am trying to save messages as a MSG format. I checked on the forum and
> found the code but when I save, the file name is not completely written
> and
> the file size is 0 bytes. Right now the code is only for the open
> message.
> Ideally, I would like the code to be run on an Outlook folder. I am
> operating in a Vista Enterprise environment. Any help would be greatly
> appreciated.
>
> -----VBA Code-----
> Sub SaveAsTXT()
> Dim myItem As Outlook.Inspector
> Dim objItem As Object
> Dim strname As String
>
>
> Set myItem = Application.ActiveInspector
> If Not TypeName(myItem) = "Nothing" Then
> Set objItem = myItem.CurrentItem
>
> strname = "U:\E-Mail\" & objItem.SenderName & " " & objItem.Subject
> & objItem.Sent & ".msg"
> MsgBox strname
> 'Prompt the user for confirmation
> Dim strPrompt As String
> strPrompt = "Are you sure you want to save the item? " & _
> "If a file with the same name already exists, " & _
> "it will be overwritten with this copy of the file."
> If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then
> objItem.SaveAs strname, olMSGUnicode
> End If
> Else
> MsgBox "There is no current active inspector."
> End If
> End Sub
> -----End of VBA Code-----
10 May 2010Re: MailItem.SaveAs not working.Ken Slovak - [MVP - O...
11 May 2010\ Re: MailItem.SaveAs not working.Chris
11 May 2010   \ Re: MailItem.SaveAs not working.Ken Slovak - [MVP - O...
14 May 2010      \ Re: MailItem.SaveAs not working.Chris
14 May 2010         \ Re: MailItem.SaveAs not working.Ken Slovak - [MVP - O...
14 May 2010            \ Re: MailItem.SaveAs not working.Chris
14 May 2010               \ Re: MailItem.SaveAs not working.Ken Slovak - [MVP - O...
21 May 2010                  \ Re: MailItem.SaveAs not working.Chris
21 May 2010                     \ Re: MailItem.SaveAs not working.Ken Slovak - [MVP - O...
25 May 2010                        \ Re: MailItem.SaveAs not working.Chris
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)