S
Smlt
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
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