G
Guest
Hi,
I have the following script which takes an email detaches all attachments
and saves them as csv. This was working fine yesterday when I was using
Outlook 2002 but today I updgraded to 2003 and now doesn't fire. I've tried
lowering the macro security to low and tried to recreate the rule, also
re-started outlook but the rule still doesn't fire. Does anybody know what's
wrong?
Thanks,.
Panos.
Script below...
Sub MessageRuleSaveAttachment(Item As Outlook.MailItem)
Dim oFSO As FileSystemObject
Dim app As Excel.Application
Dim oWorkbook As Excel.Workbook
Dim File_Save_Name As String
Dim DestDir As String
DestDir = "\\ldnprdapp16\ftp$\impliedVol\"
Set oFSO = New FileSystemObject
Set app = New Excel.Application
app.DisplayAlerts = False
For Each att In Item.Attachments
att.SaveAsFile DestDir & att.FileName
'Item.SaveAs ("c:\test\save\Test.msg")
Item.Delete
Set oWorkbook = app.Workbooks.Open(FileName:=DestDir & att.FileName,
ReadOnly:=True, Editable:=False)
' prepare the file and remove the .xls bit
File_Save_Name = InStr(1, att.FileName, ".xls", 1) - 1
File_Save_Name = Mid(att.FileName, 1, File_Save_Name) & ".csv"
'Save the csv file into the Pending dir
oWorkbook.SaveAs FileName:=DestDir & "Pending\" & File_Save_Name,
FileFormat:=xlCSV, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False
att.Delete
Next
' clean the application objects etc
Set oFSO = Nothing
app.Quit
Set oWorkbook = Nothing
Set app = Nothing
End Sub
I have the following script which takes an email detaches all attachments
and saves them as csv. This was working fine yesterday when I was using
Outlook 2002 but today I updgraded to 2003 and now doesn't fire. I've tried
lowering the macro security to low and tried to recreate the rule, also
re-started outlook but the rule still doesn't fire. Does anybody know what's
wrong?
Thanks,.
Panos.
Script below...
Sub MessageRuleSaveAttachment(Item As Outlook.MailItem)
Dim oFSO As FileSystemObject
Dim app As Excel.Application
Dim oWorkbook As Excel.Workbook
Dim File_Save_Name As String
Dim DestDir As String
DestDir = "\\ldnprdapp16\ftp$\impliedVol\"
Set oFSO = New FileSystemObject
Set app = New Excel.Application
app.DisplayAlerts = False
For Each att In Item.Attachments
att.SaveAsFile DestDir & att.FileName
'Item.SaveAs ("c:\test\save\Test.msg")
Item.Delete
Set oWorkbook = app.Workbooks.Open(FileName:=DestDir & att.FileName,
ReadOnly:=True, Editable:=False)
' prepare the file and remove the .xls bit
File_Save_Name = InStr(1, att.FileName, ".xls", 1) - 1
File_Save_Name = Mid(att.FileName, 1, File_Save_Name) & ".csv"
'Save the csv file into the Pending dir
oWorkbook.SaveAs FileName:=DestDir & "Pending\" & File_Save_Name,
FileFormat:=xlCSV, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False
att.Delete
Next
' clean the application objects etc
Set oFSO = Nothing
app.Quit
Set oWorkbook = Nothing
Set app = Nothing
End Sub