save attachment using outlook 2007

J

Jim

I have written a code to save and rename an attachment after an outlook rule
sorts the email into a folder. My issue is that I wrote it for outlook 2003
and we are currently being upgraded to outlook 2007. I have not programmed in
2007 (I am new to programming) and I am hoping someone can shed some light on
what changes I need to make so that it runs. Here is what I have:

Sub CAMPMM2(Item As Outlook.MailItem)

Set FSOC = CreateObject("scripting.filesystemobject")
filecountC = FSOC.GetFolder("M:\CAMPMM\").Files.Count

If filecontC > 0 Then
FSOC.deletefile "M:\CAMPMM\CAMPMM.zip"

End If

For Each Atmt In Item.Attachments
' This filename path must exist! Change folder name as
necessary.

ext = Atmt.FileName
ext = Right(ext, Len(ext) - InStrRev(ext, ".") + 1)
FileName = "M:\CAMPMM\CAMPMM" & ext
'Atmt.SaveAsFile FileName

Atmt.SaveAsFile FileName
i = i + 1
'Set Item = Item.FindNext

Next Atmt
End Sub


Thanks - Jim
 
K

Ken Slovak - [MVP - Outlook]

Virtually all Outlook macro code from versions prior to Outlook 2007 will
run unchanged in Outlook 2007. Your code is no exception.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top