+ Reply to Thread
Results 1 to 3 of 3

Alter existing VBA code for font and font size

  1. #1
    Forum Contributor
    Join Date
    05-12-2021
    Location
    USA
    MS-Off Ver
    Microsoft Office LTSC Professional Plus 2021
    Posts
    212

    Alter existing VBA code for font and font size

    Hello, I found a code that will allow me to export a selection that I highlight in excel to the body of an email. It works great but I was wondering how I might have outlook keep the font consistent. In the excel file, the font is Calibri size 11 so that's what I'd also like the rest of the added text in the email body to be. The code is:

    Please Login or Register  to view this content.
    So the part where i have:

    .HTMLBody = "Updated attendance through " & CDate(Date - 1) & RangetoHTML(rng)

    Currently that is coming up as Times New Roman size 12. Can this code somehow incorporate having Calibri 11 for that line?

    Also, is it also possible to have my Outlook signature appear after it pastes the table? This composes an email without my signature. Thanks in advance for any help!
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Alter existing VBA code for font and font size

    To change the font and size, you would need to use <font> tag.

    See: https://www.w3schools.com/HTML/tryit...e=tryhtml_font

    As for the signature, see: https://www.rondebruin.nl/win/s1/outlook/signature.htm
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    05-12-2021
    Location
    USA
    MS-Off Ver
    Microsoft Office LTSC Professional Plus 2021
    Posts
    212

    Re: Alter existing VBA code for font and font size

    Sorry but I'm really struggling here. I only have the most basic understanding of VBA and really just Google what codes I need and then paste them into the excel files. When it comes to altering them, I really don't know what I'm doing. I took a stab at it and of course it's not working but the best I could come up with was what I made in Bold underline:

    Please Login or Register  to view this content.
    I can get the signature to attach in the email now with this, but the signature normally has an image in it but that is not displaying in the email with this altered code. This was my wild guess. Am I even somewhat close? The font issue I'm still unsure on how to do.
    Last edited by PitchNinja; 06-24-2022 at 10:54 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 07-31-2021, 03:23 PM
  2. Refer .font.name, .font.size, line.dashstyle to a cell instead of hard coding.
    By avarshav in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2016, 11:50 AM
  3. Replies: 15
    Last Post: 05-31-2012, 10:34 AM
  4. Replies: 3
    Last Post: 07-06-2011, 01:30 PM
  5. Replies: 5
    Last Post: 04-22-2011, 10:21 AM
  6. Dropdown list for font size, font type and number formats
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1