Font Type and Space

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
In the past, you have given me the way to create some words that are in the outlook email upfront and then there is space below the words as well as another code that fonts the words.......So here is the code you gave me that creates the email to the identified contact, puts at the top the words: Dear "firstname" and adds the email template I want to use....So how do we put one space line below the words Dear First Name, so the words of the email template will be one line below, and secondly, how do we create the font and size for the words Dear FirstName.....as I would like the font to be Times New Roman, and the size 14....and maybe make it bold....Can we do this right away please?? Public Sub MacroName()

Set oContact = GetCurrentItem()

Dim objMsg As MailItem

' Blank message

' Set objMsg = Application.CreateItem(olMailItem)

' Use a template

Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\emailtemplate.oft")
objMsg.To = oContact.Email1Address
'displays the message form so you can enter more text
objMsg.HTMLBody = "Dear " & oContact.FirstName & ":" & vbCrLf & vbCrLf & objMsg.HTMLBody

objMsg.BodyFormat = olFormatHTML
MsgBody = objMsg.HTMLBody

objMsg.Display
'use this to send to outbox
'objMsg.Send
Set objMsg = Nothing

End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
The following code line creates spacing and the font, but not the size of the font....so if there is something to change to create the size and make it bold, I appreciate it. objMsg.HTMLBody = "<p style= font-family:TimesNewRoman;font-size:16>" & "Dear " & oContact.FirstName & ":" & "</p>" & objMsg.HTMLBody
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Any possible update this weekend?????
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I hope!!! And feel good!!!
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
To All if This Helps:

I found a code for Outlook where you put in that code the Word code you recorded, and it works in Outlook 2007. So I recorded the concept of going to the top of the words, selecting the full first line, and creating the font and font size for it, and then put that code in the code for Outlook, and then at the end of the Macro that creates the "Dear First Name" for the email, it runs the second macro in the first macro and its done. So here is the macro that I added to the end of the first macro. Also, you put the word code after the line: Set Selection = Word.Selection

Public Sub FormatTopLineTNR14()
Dim Ins As Outlook.Inspector
Dim Document As Word.Document
Dim Word As Word.Application
Dim Selection As Word.Selection
Set Ins = Application.ActiveInspector
Set Document = Ins.WordEditor
Set Word = Document.Application
Set Selection = Word.Selection
Selection.HomeKey Unit:=wdStory
Selection.MoveRight Unit:=wdWord, Count:=4, Extend:=wdExtend
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 14
Selection.MoveRight Unit:=wdWord, Count:=1

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
And for the benefit of others who might find this thread, the Selection. lines are what gets copied from the macro recorder in word.

If you want to do the entire first line, you might want to change the moveright line to select the entire line, for the times when people have short or long names. :)

Try

Selection.HomeKey Unit:=wdLine, Extend:=wdExtend

Code:
   With Selection
       .GoTo What:=wdGoToSection, Which:=wdGoToFirst
       .HomeKey Unit:=wdLine, Extend:=wdExtend
       .Expand wdLine
       .Font.Name = "Times New Roman"
       .Font.Size = 14
       .MoveRight Unit:=wdWord, Count:=1
   End With
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks very much! Just need to fix that other code with the "If line" for the email address.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
Rupert Dragwater Can't save font type in Outlook 2010 Using Outlook 3
T Unable to change font type in email messages. Using Outlook 3
B I would like to change the font type, & font size globally for appointment notes that I allready hav Using Outlook 1
T Outlook Contacts ... Changing Font Size, Style, Bold, etc. Using Outlook 2
F Default font for notes in contacts Using Outlook 1
Marc2019 Outlook 2016 Font Problem Using Outlook 5
S Outlook 2010 unable to change default font Using Outlook 7
M Message list font changed after update Using Outlook 2
P Message List Font Changed Using Outlook 6
B Change font of reminder of an email header Outlook VBA and Custom Forms 3
R Setting font and color used when replying to an email Outlook VBA and Custom Forms 3
CWM030 Call me old if you want. OL 2016 font size out of the box. Using Outlook 3
M Outlook 2016: Changing default font for Notes and Reading Pane Using Outlook 4
D font control by keyboard Using Outlook 2
M font format discrepancies with Quick Parts Using Outlook 1
Steven 2007 New PC vs Old PC - Micro Font on Inbound Emails :( Using Outlook 4
D Font in Reply is much larger than normal, how to reset ...? Using Outlook 4
Rupert Dragwater Can't change font size Using Outlook 5
O How to paste website content using a specific font and removing URLs Using Outlook 2
T "From" field font size in table list of emails Using Outlook 0
K Paste from Windows Clipboard then change font without losing formatting Outlook VBA and Custom Forms 1
S Default Font in body of Task Using Outlook 0
O VBA to Run Font Change on Outlook Startup Outlook VBA and Custom Forms 4
Diane Poremsky How to Change the Font used for Outlook's RSS Feeds New Slipstick.com Articles 0
S Outlook 2007, windows 10 Font size Using Outlook 1
L Outlook 2007 Font Using Outlook 3
J Increase font size of message body Using Outlook 5
D Outlook 2007 e-mail header- How to set font & font size in received message headers ? Using Outlook 2
J Font size changed in new mail messages Using Outlook 5
Rupert Dragwater unable to change font sizes in some replies Using Outlook 3
D Conditional formatting - font sizes Using Outlook 3
O How to increase Font size in Outlook 2013 Using Outlook 1
Fozzie Bear Change the colour or font of individual email accounts in outlook 2010/13 Using Outlook 1
K Untitled Appointment Font Using Outlook 1
J Change Default View - Color and font Using Outlook 3
J Changing Contact Notes Font Outlook VBA and Custom Forms 9
R Can't modify Outlook view font with IE anymore (even though IE still affects print font) Using Outlook 5
B Outlook 2007 Save Current View,Font,Toolbar Settings Using Outlook 6
O Copy email content and paste into new Word Document using a different font Using Outlook 1
P Outlook 2010 custom form olk control font size increases everytime form is published Outlook VBA and Custom Forms 1
M Default font Using Outlook 2
D Default Font in Outlook 2013 Using Outlook 3
F Outlook 2010 custom font style duplicates itself every time I save a task Using Outlook 0
D Point Size for Fonts in Custom Font Style (Outlook 2013) Using Outlook 0
P Outlook 2010 Font on Reply Email is Very Small Ruler Will Not Extend Using Outlook 2
J Microsoft Outlook 2007 Font Size Too Small Using Outlook 1
P Changing all email signatures (font, color) at once in outlook 2007 Using Outlook 2
M Assigning a specific font color to new emails using rules when they arrive Using Outlook 3
V how to make default font on arabic Using Outlook 1
D Outlook 2010: Change the font for the area at the top of an open email. Using Outlook 1
Similar threads


















































Top