forward - Forwarding Outlook Item as attachment and adding it to a category in the same VBA macro -


i have macro works forwarding multiple outlook items attachments. i've pasted below, want add forwarded message(s) category in outlook. so, not forward items in inbox recipient, mark items in category. way track items have forwarded using macro. now, show me item has been forwarded on such , such date, may have been regular forwarding action. hence need macro add item specialized category.

sub forwardselecteditems()  on error resume next  dim objitem outlook.mailitem  if application.activeexplorer.selection.count = 0    msgbox ("no item selected")    exit sub end if  each objitem in application.activeexplorer.selection     set objmsg = objitem.forward()     objmsg         .attachments.add objitem, olembeddeditem         .subject = "example"         .to = "example@example.com"         .body = “”         .send     end  next  set objitem = nothing set objmsg = nothing  end sub 

the categories property of mailitem class allows set string representing categories assigned outlook item. here msdn states:

categories delimited string of category names have been assigned outlook item. property uses character specified in value name, slist, under hkey_current_user\control panel\international in windows registry, delimiter multiple categories. convert string of category names array of category names, use microsoft visual basic function split.

note, can use categories property of namespace class categories object represents set of category objects available. property represents master category list, set of category objects can applied outlook items contained namespace object, , applies users of namespace.

also may consider specifying savesentmessagefolder mail item. property allows set folder object represents folder in copy of e-mail message saved after being sent. so, can recognize auto-forwarded messages.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -