Outlook項目可能被命名爲/具有文件名中非法字符的主題。
例如在
任務名稱冒號:KM_CEM_GY
有解決此至少兩個標準方法。
Outlook 2010 VBA How to save message including attachment
Private Sub ReplaceCharsForFileName(sName As String, sChr As String)
sName = Replace(sName, "'", sChr)
sName = Replace(sName, "*", sChr)
sName = Replace(sName, "/", sChr)
sName = Replace(sName, "\", sChr)
sName = Replace(sName, ":", sChr)
sName = Replace(sName, "?", sChr)
sName = Replace(sName, Chr(34), sChr)
sName = Replace(sName, "<", sChr)
sName = Replace(sName, ">", sChr)
sName = Replace(sName, "|", sChr)
End Sub
VBA dialog boxes automatically answer solution
Function StripIllegalChar(StrInput)
Dim RegX As Object
Set RegX = CreateObject("vbscript.regexp")
RegX.Pattern = "[\" & Chr(34) & "\!\@\#\$\%\^\&\*\(\)\=\+\|\[\]\{\}\`\'\;\:\<\>\?\/\,]"
RegX.IgnoreCase = True
RegX.Global = True
StripIllegalChar = RegX.Replace(StrInput, "")
ExitFunction:
Set RegX = Nothing
End Function
這看起來不像'vb.net' ...以及它的一些與'vb6'混合。你能描述一下「它不適用於展望項目」嗎? – Codexer
sry ..........其不是vb.net的vba代碼。此代碼適用於.txt或.excel或其他格式的附件,但不適用於文件類型展望。查看圖像以瞭解Outlook格式的外觀 –