logo
down
shadow

Setting categories using VBA on a selection does not seem to work in Outlook 2007


Setting categories using VBA on a selection does not seem to work in Outlook 2007

By : user3851462
Date : October 16 2020, 11:12 PM
it helps some times I'm trying to set the mail message categories for the current selection. When I run the macro I end up in only a single message being set to the given categorie. I Use the following code (and have also tried to use a do until..loop using the selection.count): , Save the mailMsg item each time, like this:
code :


Share : facebook icon twitter icon
OL 2007 Addin: Get HTML formatted selection from Outlook inspector window

OL 2007 Addin: Get HTML formatted selection from Outlook inspector window


By : user3123052
Date : March 29 2020, 07:55 AM
help you fix your problem Im not sure, but try the methods Range.Paste, Range.PasteSpecial and Range.PasteFormat. i use this methods in Excel.Range in smiliar situations. office applications has an own clipboard but no way to access programaticly(sad)
How to get selection in a mailItem Body using outlook addin 2007 and VSTO c#

How to get selection in a mailItem Body using outlook addin 2007 and VSTO c#


By : Shingen Chen
Date : March 29 2020, 07:55 AM
wish help you to fix your issue outlook cannot get the selected text in the mail body,so convert the outlook to word editor, so you can follow the 3 steps
code :
1. get the mail total body
2. use the word editor based on the **microsoft.office.Interop.word** dll
3.select the text and to store the any string 
object oItem;
Outlook.Application oApp=new Outlook.Application();
 Outlook.Explorer oExp=oApp.ActiveExplorer();
 Outlook.Selection oSel= oExp.Selection;
 for (i = 1; i <= oSel.Count; i++)
                {
                    oItem = oSel[i];
        Outlook.MailItem oMail = (Outlook.MailItem)oItem;
Outlook.Inspector inspector = oMail.GetInspector;

            // Obtain the Word.Document object from the Inspector object
            Microsoft.Office.Interop.Word.Document document = (Microsoft.Office.Interop.Word.Document)inspector.WordEditor;
mailItem.Body = document.Application.Selection.Text;
}
Outlook 2007+ Cast Application.ActiveExplorer.Selection.Item to Outlook.mailItem when TypeOf Item = Outlook.mailItem

Outlook 2007+ Cast Application.ActiveExplorer.Selection.Item to Outlook.mailItem when TypeOf Item = Outlook.mailItem


By : MAO
Date : March 29 2020, 07:55 AM
Hope this helps I have not tested your code but here are a couple points that might help.
Outlook VBA is not the same as VB.NET. VB.NET is a later generation and has many improvements.
How to make addin solution of outlook 2010 to work in outlook 2007?

How to make addin solution of outlook 2010 to work in outlook 2007?


By : Codebacca
Date : March 29 2020, 07:55 AM
hop of those help? You have to start with a 2007 addin, and it will work with 2007 and 2010. You always need to target the lowest version you want to support. The newer versions can load add ins from previous versions but not typically the other way around.
Setting Categories works intermittently Outlook VBA

Setting Categories works intermittently Outlook VBA


By : Aleksandr Pupkov
Date : March 29 2020, 07:55 AM
hope this fix your issue This is multiple dot notation taken to its extreme - the following code sets Unread property on one object and calls Save on a completely different object that has no idea about anything else your code has previously done.
code :
oItems.Item(i).UnRead = False
oItems.Item(i).Save
Function MoveSort(olDestination As Outlook.Folder, Item as Object)
Dim StCategory
If Item.Categories = "" Then
    Item.Categories = "Category"
End If

Item.UnRead = False
Item.Save
Item.Move olDestination
End Function

...
Dim Item as Object
For i = oItems.Count To 1 Step -1
    set Item = oItems.Item(i)
    SEmail = Item.SenderEmailAddress
    SSubject = Item.Subject
    If SEmail = "Email1@email..com" Or SSubject = "Sample Subject 1" Or _
        Left(SSubject, 16) = "Sample Subject 2" Then

        MoveSort oStock, Item

    ElseIf SEmail = "Email2@email.com" Then

        MoveSort oBStock, Item

    ElseIf SEmail = "Email3@email.com" Then

        MoveSort oCStock, Item
    End If
Next i
shadow
Privacy Policy - Terms - Contact Us © bighow.org