vba - How to set charset in a outlook macro -
I have an Outlook macro to extract email addresses from non-distributed reports in a specific folder. The macro runs, but when reading the element of the body it is 'very'? 'And some other characters, I think this is a problem with charset, but I can not know how it can change. any idea?
This is part of my code; When I get a message box from the "MessageBox (Strembody)" line, then this '?'
Even after running the macro, the original email in Outlook is just Chinese-looking characters.
in olFolder.Items for each obj '** Loop through selected Outlook folder * xlApp.StatusBar = x & amp; "Ka" & amp; Calculation & amp; "Full email" stremBody = obj.body stremSubject = obj.Subject if e-mail (stremBody) = 'checks email for keywords in email' message message ("search email:" and "RAMBODIE ') ** Addressing RegEx with the RegEx message body to find the email. Pattern = "[B] [Age] {2,4} \ b "IgnoreCase = true .MultiLine = true .Global = false set olMatches = .Execute (stremBody) function from executing regular expression '' loop each match in olMatches xlwksht.Cells through RegEx Matches (I + 2, 1) .Value = Match I = I + 1 Next Match and Tread To: E-mail, or mark the mark which was removed from the address' ** to those items To see who do not send messages to the following line, MSBBbox (Strebowdy) end if X = A Bus + 1 Next OBG And it's full address is:
sub extract_Invalid_To_Excel () Dim Olap as Outlook. K.Explorer dim olFolder Outlook. MAPIFolder dim obj as object dim stremBody string dim stremSubject as string dim as I as dim long dim long as x long dim RegEx as object set RegEx = CreateObject as count ( "VBScript.RegExp") in the form of dim xlApp object 'Excel.Application as a dim xlwkbk object' Excel.Workbook dim xlwksht item In 'Excel.Worksheet dim xlRng in kind' Excel.Range set olApp = Outlook.Application set OLEXP = olApp.ActiveExplorer set olFolder = olExp.CurrentFolder 'Excel set to open xlApp = GetExcelApp xlApp.Visible = true xlApp some also is not defined Goto ExitProc set xlwkbk = xlApp.Workbooks.Add set xlwksht = xlwkbk.Sheets (1) set xlRng = xlwksht.Range ( "A1") xlRng.Value = "number of email objects 'e' Calculate the count of mail objects = excel sheet i = 0 'counter for email x = 1 for each object in the alfoster. Items' ** Loop through selected Outlook Folder * xlApp .tatesbar = X & amp; "Ka" & amp; Calculation & amp; "Full email" stremBody = obj.body stremSubject = obj.Subject if e-mail (stremBody) = 'checks email for keywords in email' message message ("search email:" and "RAMBODIE ') ** Addressing RegEx with the RegEx message body to find the email. Pattern = "[B] [Age] {2,4} \ b "IgnoreCase = true .MultiLine = true .Global = false set olMatches = .Execute (stremBody) function from executing regular expression '' loop each match in olMatches xlwksht.Cells through RegEx Matches (I + 2, 1) .Value = Match I = I + 1 Next Match and Tread To: E-mail, or mark the mark which was removed from the address' ** to those items To see who do not send messages to the following line, MSBBbox (Strebowdy) end if X = A X + 1 Next OBG XlApp.ScreenUpdating = True MsgBox ("invalid email addresses are being removed") ExitProc: set xlRng = nothing set xlwksht = nothing set xlw KBK = nothing set xlApp = some Also do not set emItm = nothing set olFolder = nothing set olNS = nothing set olapp = nothing End sub function GetExcelApp () Always start again as object Next Set new instance on getExcelApp = CreateObject error To create ("Excel.Application") error goto function 0 function Do not check the e-mail (as the string in the form of a verbal body) as a Boolean deum keyword (3) string keyword (0) = "recipient's e-mail address not found" keyword (1) = "error Quote this message "keyword (2) =" message was not delivered "'Default value check email = false for each word in keyword if INSAT (1, body, word, vbTextCompare) & gt; 1 To check again e-mail = true exit for and if next word and function
Comments
Post a Comment