Macro for other actions - Outlook 2007

Status
Not open for further replies.

Steve Mc

New Member
Outlook version
Email Account
POP3
I’m used to recording macros in Excel, but don’t know how to do that in Outlook 2007.

When receiving an email that has been replied to 4 or 5 times or more, often portions if the original message, or even some of the previous responses, are changed to very large fonts, usually 120 point.

Also, often some the previous responses are formatted with one word per line on the far right.

Like

this

it

makes

for

long

emails.





I have to manually Select all-Other Actions-Edit Message, change the Font to a reasonable size like 12, then exit to save. That will at least fix the large font problem.

I would like to have a macro do that to specific chosen emails , but do not know how to even begin to write it.

I’d like to also have the vertical problem fixed too, but not sure if that is possible.



Thanks,
 
>> are changed to very large fonts, usually 120 point.
That is often due to an antispam scanner corrupting the CSS by removing the dot/point in 12.0 MacAfee had a habit of doing this off and on. I don't know if it still does... the other possibly is the user has zoom set low and changed the font so they can see it.

>> Also, often some the previous responses are formatted with one word per line on the far right.
This can be caused by someone adjusting the margins in email, like they would in word, instead of adjusting the window size. The markings as 'in from left, in from right' so if someone opened a new message at full screen and adjusts the right margin so its more like a 80 character wide, the margin might be 6" in from right - it may not be noticeable at first, but one or two indented replies can condense it enough to be a problem.

To fix a wide screen - resize the new mail window, like this:


2020-10-02_13-25-03-0000.png


Don't change the margins, like this, it will squish the lines when the message is read in a smaller window.

2020-10-02_13-24-59-0000.png
 
The other receiver/sender is usually emailing from an Ipad, and does not change any other settings, just replies as is. Also MacAfee is not involved in these cases. Note that the large font and vertical formatting usually doesn't happen until maybe the 5th or 6th reply.

So can there be a macro to do the following on an opened email that is displaying some 120 pt. font size: Select All-Other Actions-Edit Message-Format Text- (select) 12 point font- Exit - Save ?

Thanks
 
Yes, a macro can fix that. I will see if I have one - if not, vboffice.net might.
 
I have this one - if the font size is always the same 120px, I'd have it look for the font attribute and change it. It might be in the message list this:
style="font-size:120pt;font-family:"Arial&quot...

so you'd have the macro look for font-size:120pt and replace it with font-size:12.0pt


there is a sample on the page that changes the email font

 
Thank you. Unfortunately, they're not always the same size. I just used 120 pt. as an example. Others are 150 pt. font. I've already manually changed prior ones to all 12 pt., so I'm not exactly sure what those sizes were. And that's why I just thought the easiest way would be to select the entire email message, and change all fonts to 12 pt. In fact, that's what I'm doing manually. The Arial, New Times ,etc, does not matter. I'll keep those what they are.

Thanks,
 
I'll see if I have one that can do the whole message list that.
 
I don't have one already that does it - will need to wrote one. It would be a select all and change the font size - it should be easy enough. I'll take a look tomorrow.
 
Oh wait - I have this one. It works on the selected text - but doesn't select the entire message.

This will select the entire message - use it before the font change.
With objSel
'use wholestory to copy the entire message body
.WholeStory
End With
 
OK,that's a start. Thanks.

But woukld it be to much trouble to give me a step by step process, because I have absolutly no experience with Outlook marcos ?
 
This code will change the font since of the message to the specified size. I didn't test it in 2007, but it should work. You need to set a reference to word object model.

Code:
 Public Sub FormatSelectedText()
    Dim objItem As Object
    Dim objInsp As Outlook.Inspector
    
    ' Add reference to Word library
    ' in VBA Editor, Tools, References
    Dim objWord As Word.Application
    Dim objDoc As Word.Document
    Dim objSel As Word.Selection
    On Error Resume Next
  
'Reference the current Outlook item
    Set objItem = Application.ActiveInspector.currentItem
    If Not objItem Is Nothing Then
        If objItem.Class = olMail Then
            Set objInsp = objItem.GetInspector
            If objInsp.EditorType = olEditorWord Then
                Set objDoc = objInsp.WordEditor
                Set objWord = objDoc.Application
                Set objSel = objWord.Selection
If objDoc.ProtectionType = WdProtectionType.wdAllowOnlyReading Then objDoc.UnProtect
' replace the With block with your code
       With objSel
       .WholeStory
      
       ' Formatting code goes here
            '.Font.Color = wdColorBlue
            .Font.Size = 12
            '.Font.Bold = True
            '.Font.Italic = True
            '.Font.Name = "Arial"
       End With
            End If
        End If
    End If
objItem.Save
    
    Set objItem = Nothing
    Set objWord = Nothing
    Set objSel = Nothing
    Set objInsp = Nothing
End Sub
 
OK I'm not really sure what I am doing, but I copied the above into a module(project 1). Then I manually selected all the text in an email, and then went to Tools - Macro - Macros, and selected the macro and ran it, I received a compile error, user defined type not defined,
and this was highlighted -> Dim objWord As Word.Application
 
You need to set a reference to the word object model in tools > References. There is a screenshot of the dialog at the end of the article

You don't need to select the test in the message - just open the message and run the macro.
 
Ok, I did that, and I have 4 items checked:

Visual Basic for Applications
Microsoft Outlook 12.0 object library
OLE Automation
Microsoft Office 12.0 object library

But get the same compile error. I said OK. Is there something else that should be checked ?
 
It should work - I'll test it in office 2007 in the morning.
 
It worked fine for me when I added the reference to the word object - open a message, run the macro.


2020-10-19_21-57-12-0000.png
 
For some reason, I do not have that Microsoft Word 12.0 Object Library as an available reference.
 
Is there a way I coulds get the Microsoft Word 12.0 Object Library? Or some other method ?

Thanks,
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
X Run macro automatically when a mail appears in the sent folder Using Outlook 5
mrrobski68 Issue with Find messages in a conversation macro Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
M Use Macro to change account settings Outlook VBA and Custom Forms 0
J Macro to Reply to Emails w/ Template Outlook VBA and Custom Forms 3
C Outlook - Macro to block senders domain - Macro Fix Outlook VBA and Custom Forms 1
Witzker Outlook 2019 Macro to seach in all contact Folders for marked Email Adress Outlook VBA and Custom Forms 1
S macro error 4605 Outlook VBA and Custom Forms 0
A Macro Mail Alert Using Outlook 4
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
J Macro to send email as alias Outlook VBA and Custom Forms 0
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro GoTo user defined search folder Outlook VBA and Custom Forms 6
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to check Cursor & Focus position Outlook VBA and Custom Forms 8
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
M Outlook 2019 Macro not working Outlook VBA and Custom Forms 0
S Outlook 365 Help me create a Macro to make some received emails into tasks? Outlook VBA and Custom Forms 1
Geldner Send / Receive a particular group via macro or single keypress Using Outlook 1
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 21
V Macro to count flagged messages? Using Outlook 2
sophievldn Looking for a macro that moves completed items from subfolders to other subfolder Outlook VBA and Custom Forms 7
S Outlook Macro for [Date][Subject] Using Outlook 1
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3
E Macro to block senders domain Outlook VBA and Custom Forms 1
D VBA Macro to Print and Save email to network location Outlook VBA and Custom Forms 1
N VBA Macro To Save Emails Outlook VBA and Custom Forms 1
N Line to move origEmail to subfolder within a reply macro Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to answer a mail with attachments Outlook VBA and Custom Forms 2
A Outlook 2016 Macro to Reply, ReplyAll, or Forward(but with composing new email) Outlook VBA and Custom Forms 0
J Macro to Insert a Calendar Outlook VBA and Custom Forms 8
W Macro to Filter Based on Latest Email Outlook VBA and Custom Forms 6
T Macro to move reply and original message to folder Outlook VBA and Custom Forms 6
D Autosort macro for items in a view Outlook VBA and Custom Forms 2
S HTML to Plain Text Macro - Help Outlook VBA and Custom Forms 1
A Macro to file emails into subfolder based on subject line Outlook VBA and Custom Forms 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
S Visual indicator of a certain property or to show a macro toggle Outlook VBA and Custom Forms 2
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
S Macro to extract and modify links from emails Outlook VBA and Custom Forms 3
M Replyall macro with template and auto insert receptens Outlook VBA and Custom Forms 1
L Macro to add Date & Time etc to "drag to save" e-mails Outlook VBA and Custom Forms 17
S Macro for Loop through outlook unread emails Outlook VBA and Custom Forms 2
Globalforester ItemAdd Macro - multiple emails Outlook VBA and Custom Forms 3
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 2
Witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
Witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3

Similar threads

Back
Top