Share via


Outlook Email Archiving Macro Doesnt work if subject has asterisk

Question

Wednesday, April 15, 2020 10:20 AM | 1 vote

I am using the following code to archive my emails to a designated folder which works perfectly at the moment.... UNLESS the email subject contains an *... this then gives a debug message "run-time error '-2147286788 (800300fc)'

Is there anything I can add into the below code to make it ignore or replace the * to something else to allow it to automatically archive these emails?

All replies (2)

Wednesday, April 15, 2020 10:31 AM

Remove all the Replaces and add in this instead (changing characters as necessary) -

sName = RemoveSpecials(sName)

Function RemoveSpecials(strInput As String) As String
    Dim strChars As String
    strChars = "!£$%^&*()_+{}@~:<>?,./;'#[]-=`¬¦" & Chr(34)
    Dim intIndex As Integer
    For intIndex = 1 To Len(strChars)
        strInput = Replace(strInput, Mid(strChars, intIndex, 1), "")
    Next
    RemoveSpecials = strInput
End Function

I hope this will help you with office 365 archive mailbox.


Thursday, April 16, 2020 1:42 AM

Hi,

Welcome to our forum.

Since here we mainly focus on general issues about Outlook desktop client but your question is more related to Outlook developer code, it is suggested to post a new thread to the Outlook for developer forum.

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thanks for your understanding and hope your question will be resolved soon.

Regards,

Aidan Wang

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].