I made a script to save attachments automatically and print them.
Sub SaveAttachment(Item As MailItem)
If Item.Class = olMail Then
If Item.Attachments.Count > 0 Then
Dim objAtt As Outlook.Attachments
Set objAtt = Item.Attachments
For Each objAttach In objAtt
objAttach.SaveAsFile "C:\PDFInvoices\" & _
Item.Subject & "_" & objAttach.FileName '
Next
Set objAtt = Nothing
End If
End If
End Sub
An attachment containing special characters such as #
or &
makes the script crash.
I want a way to replace, the special characters by something else.