Outlook VBA Move Single Email To Numerous Folders -
i move email 1 existing folder 1 or more subfolders.
simple example: email arrives john doe. move mmyy subfolder (that may not exist) under folder named doe, john (that may not exist). if email marked high importance, put copy of email in 2nd subfolder named "highimportance". lastly if email identified highvolumeemailer sql query, move 3rd subfolder named "highvolumeemailer".
the vba moves email mmyy folder, potentially save copies of same email 2 other folders. total of three.
here code not work:
set objdestfolder = objsourcefolder.folders(ssendername) if objdestfolder nothing set objdestfolder = objsourcefolder.folders.add(ssendername) end if set objnewfolder = objdestfolder.folders(smonthandyearofemail) if objnewfolder nothing set objnewfolder = objdestfolder.folders.add(smonthandyearofemail) end if objvariant.move objnewfolder 'count # of items moved lngmoveditems = lngmoveditems + 1 '''''if marked high importance put copy in high importance folder if semailimportance = "high" '''''set mycopieditem = objvariant.copy ''''set objdestfolder = objsourcefolder.folders(ssendername) set objhighimportancefolder = objnamespace.folders(ssendername).folders(smonthandyearofemail).folders("markedhighimportance") '''''set objhighimportancefolder = objdestfolder.folders("markedhighimportance") if objhighimportancefolder nothing set objhighimportancefolder = objnamespace.folders(ssendername).folders(smonthandyearofemail).add(smarkedhighimportance) end if objvariant.unread = true set copy = objvariant.copy copy.move.objhighimportancefolder objvariant.unread = true end if ''''''now going high volume calls semailsubject = objvariant.subject blnhighvmvolume = false lookingforthistelephonenumberinhighvolume = mid(semailsubject, 24, 10) g = 0 g = lbound(varray, 2) ubound(varray, 2) 'this code determine if telephone number in 'the high call volume population if varray(0, g) = lookingforthistelephonenumberinhighvolume blnhighvmvolume = true numberofhighvolumevms = varray(1, g) end if next g if blnhighvmvolume = true ''''''set mycopieditem = objvariant.copy set objhighvolumefolder = objnamespace.folders(ssendername).folders(smonthandyearofemail).folders(shighvolumecaller) if objhighvolumefolder nothing set objhighvolumefolder = objnamespace.folders(ssendername).folders(smonthandyearofemail).add(shighvolumecaller) end if objvariant.unread = true set copy = objvariant.copy copy.move.objhighvolumefolder objvariant.unread = true end if
the vba moves email mmyy folder, potentially save copies of same email 2 other folders. total of three.
it seems need use copy method of outlook items make 3 copies , move them these folders. example:
set mycopieditem = myitem.copy mycopieditem.move mynewfolder
anyway, in code have noticed following lines:
set copy = objvariant.copy copy.move.objhighimportancefolder
it looks need correct second line of code: objhighimportancefolder not property or method, argument passed function. should like:
set copy = objvariant.copy copy.move objhighimportancefolder
Comments
Post a Comment