+ Reply to Thread
Results 1 to 15 of 15

Excel Macro to Outlook (With bunch of text formatting)

  1. #1
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Excel Macro to Outlook (With bunch of text formatting)

    hey guys. I have a word template I'm trying to follow closely and hoping my excel macro can generate it format for format on Outlook. Couldn't put my current code here as it has the GREATER THAN sign that apparently triggers the security

    I have attached what it looks like in Word and the Excel file with the code and what it looks like in Outlook. I have also circled the differences currently.

    besides those above, two other minor problems I have trouble understanding is:
    - why do i have to put font size as 13 for Outlook to show it in 11 (i did trial and error and ended up with 13 for it to show as 11)?
    Please Login or Register  to view this content.
    - the body message has 2 paragraph spacing from the signature. not sure why too.
    These 2 are smaller problems I can still be ok with.

    thanks in advance!
    Attached Files Attached Files

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excel Macro to Outlook (With bunch of text formatting)

    *bump*
    seems like Excel to other applications (Outlook, PowerPoint, Word) are pretty hard to find. Tried to buy a book but doesn't really cover what I want.

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,963

    Re: Excel Macro to Outlook (With bunch of text formatting)

    This looks ok on my machine.
    In order to post this without getting a security warning I had to replace < with [
    So replace [ with < before running.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excel Macro to Outlook (With bunch of text formatting)

    Thank you, ByteMarks! this is almost accurate. I noticed you input a font size of 12 but it ends up as 11 too. And no matter what size I changed it to, it doesn't work

    instead of using "b" for bold, you used "strong", which I'm guessing is due to the "!DOCTYPE html" you used.

    the 2nd timing (4pm to 6:30 PM) not aligned to the 1st timing, but I'm willing to settle for this if there are no solutions.

    thank you once again
    Last edited by benishiryo; 07-31-2018 at 09:08 PM.

  5. #5
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,963

    Re: Excel Macro to Outlook (With bunch of text formatting)

    That's disappointing. It's size 12 font and aligned for me with outlook 2007. I guess that means that even if it looks ok for you, it might not necessarily look the same for the recipients.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Excel Macro to Outlook (With bunch of text formatting)

    I'm not an expert but I think this comes close.

    Due to firewall put the code in a textfile.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excel Macro to Outlook (With bunch of text formatting)

    thanks, bakerman2! it has different pros and cons vs ByteMark's solution.
    pros:
    the font size of the texts are now mostly Arial 10 (except for the opening hours)

    cons:
    the opening hours have unwanted paragraphing

    i'm wondering if it's a limitation or is there some solution out there

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Excel Macro to Outlook (With bunch of text formatting)

    Q: Does your output change when you decide to include or exclude signature?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  9. #9
    Forum Contributor
    Join Date
    06-07-2016
    Location
    Manila
    MS-Off Ver
    365
    Posts
    292

    Re: Excel Macro to Outlook (With bunch of text formatting)

    For the font size you forgot "pt"

    Please Login or Register  to view this content.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Excel Macro to Outlook (With bunch of text formatting)

    Played around some more.
    benishiryo.PNG
    Attached Files Attached Files

  11. #11
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excel Macro to Outlook (With bunch of text formatting)

    @humdingaling:
    no, the output doesn't change when i include signature. it will just be whatever the format i requested with a signature below. it always have additional carriage return though, but that's a side issue.

    @aarona: the line of code you suggested actually made all the font size different. but it made me look at ByteMark's solution where he used:
    Please Login or Register  to view this content.
    instead of ":=" and "px", i tried:
    Please Login or Register  to view this content.
    i somehow have to make it font size 13.5 for Outlook to present it as font size 10. weird, but it works!

    now only if the timings are in line and we can call it a day. i tried removing the nbsp but they will never be aligned.
    Outlook format.PNG

  12. #12
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excel Macro to Outlook (With bunch of text formatting)

    very strange, @bakerman2. i used your file but it doesn't show me the same. font size is 12 and timing not aligned.

    Outlook format bakerman2.PNG

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Excel Macro to Outlook (With bunch of text formatting)

    Remove some of the &nbsp; on the line with 4pm to 6:30pm until it aligns correctly.

  14. #14
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excel Macro to Outlook (With bunch of text formatting)

    @bakerman2: oh yeah i did mentioned trying to remove the &nbsp. but it didn't seem to work. i wonder what different computer settings we have that causes this. ByteMarks said his worked in his computer too.

  15. #15
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Excel Macro to Outlook (With bunch of text formatting)

    When I used this
    Please Login or Register  to view this content.
    instead of this
    Please Login or Register  to view this content.
    and removed some of the &nbsp; to this
    Please Login or Register  to view this content.
    nothing changed.
    But when using this
    Please Login or Register  to view this content.
    and this
    Please Login or Register  to view this content.
    This is what I got.
    benishiryo.PNG
    So following the logic this should aline properly for you.

+ 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. Create Outlook Reminder on Excel and transfered to outlook by macro
    By Benjamin2008 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2013, 03:23 PM
  2. [SOLVED] VBA Macro to print to Pdf format and place as attachment in Outlook (Excel & Outlook 2007)
    By Webman1012 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2013, 01:25 PM
  3. Macro to make Excel press F2 and Enter for me a bunch of times
    By nicelyj2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2012, 08:17 AM
  4. Formatting Text in powerpoint from excel-macro.
    By FlavioDenis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-27-2012, 10:04 AM
  5. [SOLVED] Macro for transposing bunch of 8 cells in a column into separate rows
    By theotherguy316 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2012, 02:43 PM
  6. VBA code to outlook with a bunch of If then statments, code will not run
    By Lee Avery in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2010, 12:08 PM
  7. need macro for renaming bunch of excel files
    By neowok in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2005, 02:05 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