Macro for other actions - Outlook 2007

Steve Mc

New Member
Outlook version
Outlook 2007
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,
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
>> 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
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Yes, a macro can fix that. I will see if I have one - if not, vboffice.net might.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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

 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
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,
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'll see if I have one that can do the whole message list that.
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
I guess no help on getting a macro for my above situation ?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
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 ?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
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 ?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It should work - I'll test it in office 2007 in the morning.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
For some reason, I do not have that Microsoft Word 12.0 Object Library as an available reference.
 

Steve Mc

New Member
Outlook version
Outlook 2007
Email Account
POP3
Is there a way I coulds get the Microsoft Word 12.0 Object Library? Or some other method ?

Thanks,
 
Similar threads
Thread starter Title Forum Replies Date
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
L Macro/VBA to Reply All, with the original attachments Outlook VBA and Custom Forms 2
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
Eike Move mails via macro triggered by the click of a button? Outlook VBA and Custom Forms 0
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 4
U Macro for reminders,tasks,calendar Outlook VBA and Custom Forms 4
V macro runs slower on startup than after Outlook VBA and Custom Forms 3
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1
G VBA Macro Calendar Printing Assistant 4
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
M Outlook macro to automate search and forward process Outlook VBA and Custom Forms 6
R Macro Schedule every day in Outlook Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
geofferyh Cannot get Macro to SAVE more than one message attachment??? Outlook VBA and Custom Forms 5
N How can I increase/faster outlook VBA Macro Speed ? Using Outlook 2
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
D.Moore Folder view settings by VBA macro Outlook VBA and Custom Forms 57
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
Dave A Run macro on existing appointment when it changes Outlook VBA and Custom Forms 1
V Outlook Macro to show Flagged messages Outlook VBA and Custom Forms 2
O Run macro automatically at sending an email Using Outlook 11
R Retain Original Message When Forwarding With Macro Outlook VBA and Custom Forms 3
C Macro to add multiple recipients to message Outlook VBA and Custom Forms 3
B Reply and replyall macro is not working Outlook VBA and Custom Forms 1
O Macro - paste as plain text Outlook VBA and Custom Forms 2
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
E Copying data from e-mail attachement to EXCEL file via macro Outlook VBA and Custom Forms 38
M Macro to add date/time stamp to subject Outlook VBA and Custom Forms 4
R VBA macro - new message Outlook VBA and Custom Forms 3
S Example VBA Macro - To Conditionally Change the From Account and Add a BCC Address on Emails Outlook VBA and Custom Forms 11
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
B VBA Macro for assigning multiple Categories to an email in my Inbox Outlook VBA and Custom Forms 1
N Macro for attachment saved and combine Outlook VBA and Custom Forms 1
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
C Search with Google Macro? Outlook VBA and Custom Forms 4
J Outlook 2013 Extract Flag Completed dates to Excel Macro Outlook VBA and Custom Forms 16
M Slow VBA macro in Outlook Outlook VBA and Custom Forms 5
D Print Attachments only in selected emails using a macro Outlook VBA and Custom Forms 3
M Macro for attachments download adjustment Outlook VBA and Custom Forms 3
M VBA macro for Inbox's attachments search Outlook VBA and Custom Forms 0
B Macro to manually move selected emails to network folder Outlook VBA and Custom Forms 1

Similar threads

Top