hello friends,
i have 2 functionally identical scripts in outlook, but only 1 of them works.
this one works:
im not sure what to do...
i have 2 functionally identical scripts in outlook, but only 1 of them works.
this one works:
Public Sub Name1(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "S:\Folder\Folder"
Dim dateFormat As String
dateFormat = Format(itm.ReceivedTime, "mm.dd.yyyy")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & "File Name " & dateFormat & ".xlsx"
Next
End Sub
this one does not:Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "S:\Folder\Folder"
Dim dateFormat As String
dateFormat = Format(itm.ReceivedTime, "mm.dd.yyyy")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & "File Name " & dateFormat & ".xlsx"
Next
End Sub
Public Sub Name2(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "S:\Slightly\Different\Folder"
Dim dateFormat As String
dateFormat = Format(itm.ReceivedTime, "mm.dd.yyyy")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & "Slightly Different File Name " & dateFormat & ".pdf"
Next
End Sub
When i try to run these as a rule the second one gives the error "the script "" doesnt exist or is invalid"Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "S:\Slightly\Different\Folder"
Dim dateFormat As String
dateFormat = Format(itm.ReceivedTime, "mm.dd.yyyy")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & "Slightly Different File Name " & dateFormat & ".pdf"
Next
End Sub
im not sure what to do...