+ Reply to Thread
Results 1 to 17 of 17

Macro does not display maro in outlook correctly

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Macro does not display maro in outlook correctly

    I have the following macro which attaches a specific sheet in outlook

    When the message appears in the body it appears as :

    Hi Mark

    Regards

    Howard


    It is this part of the code that I am battling to get right, so the body of the message appears correctly

    Please Login or Register  to view this content.


    It would be appreciated if someone could kindly amend my code




    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Macro does not display maro in outlook correctly

    Please Login or Register  to view this content.
    Last edited by sintek; 04-16-2020 at 04:21 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Macro does not display maro in outlook correctly

    Is this part actually two lines? (it shouldn't be)

    Please Login or Register  to view this content.
    Rory

  4. #4
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro does not display maro in outlook correctly

    Hi Sintek


    I used your code, but nothing appears now in the body of my email using Outlook

    I have tried to see what is causing this buy cannot figure it out


    Please check and advise

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro does not display maro in outlook correctly

    Hi Rory

    It should be one line

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Macro does not display maro in outlook correctly

    What do you see if you add a message:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Macro does not display maro in outlook correctly

    The above snippet of code is outside of the With outmail statement and this part inside With statement
    Please Login or Register  to view this content.
    I also see you did not declare strBody...Ensure that your code always has Option Explicit on top....

  8. #8
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro does not display maro in outlook correctly

    Hi Sintek

    I have have amended code per your input and still get nothing in the body of outlook
    Option Explicit
    Please Login or Register  to view this content.

    Please check & advise what is possibly causing this

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Macro does not display maro in outlook correctly

    Upload your sample file...Also what result does Rory's suggestion in post 6 give...Is the value blank

    This works...
    Please Login or Register  to view this content.

    OR


    Please Login or Register  to view this content.
    Last edited by sintek; 04-16-2020 at 06:01 AM.

  10. #10
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro does not display maro in outlook correctly

    Hi Sintek


    I have uploaded my Sample file as I cannot get message to display in the body. Rory's code displays displays a blank value


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Howardc1001; 04-16-2020 at 07:08 AM.

  11. #11
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Macro does not display maro in outlook correctly

    You haven't attached a workbook, but that code creates two emails. The first has the body you specify but is never displayed.

    I suggest that you remove the On Error Resume Next line and try the code again.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Macro does not display maro in outlook correctly

    I have uploaded my Sample file
    Where?...

    Strange both the codes in post 9 work as they should...

    Howard...Your code in Post above does not have the required snippet...in the With Outmail statement
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro does not display maro in outlook correctly

    When I removed "on error resume Next" , I get a run time error-"subscript out of range and the code below is highlighted

    Please Login or Register  to view this content.

    Please check & advise

  14. #14
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Macro does not display maro in outlook correctly

    One of your sheet names is wrong then.

    This is why you shouldn't just stick On Error Resume Next into a routine for no purpose...

  15. #15
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Macro does not display maro in outlook correctly

    When I removed "on error resume Next" , I get a run time error-"subscript out of range and the code below is highlighted
    that is because the newly saved book is active...

    I am very certain this code can be tidied up...
    But anyway...
    Please Login or Register  to view this content.
    THIS IS HOW I WOULD DO IT....

    Please Login or Register  to view this content.
    Last edited by sintek; 04-16-2020 at 07:48 AM.

  16. #16
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro does not display maro in outlook correctly

    Thanks Sintek for all the help & your input


    Code works perfectly now

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Macro does not display maro in outlook correctly

    Coolio...Glad you got it sorted...

+ 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. Macro to start another Maro and do some copy and paste
    By Larbec in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2016, 10:19 PM
  2. Replies: 3
    Last Post: 07-28-2015, 05:01 PM
  3. Outlook VBA - Application.quit will not work correctly.
    By Rchie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2015, 11:12 AM
  4. Outlook - How to make outlook not to display a notification icon
    By jjin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2013, 10:53 PM
  5. MACRO - Not Enough System Resources to display correctly
    By colesky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2012, 03:39 PM
  6. Multiple Personal Maro Notebooks
    By capngene in forum Excel General
    Replies: 1
    Last Post: 02-07-2012, 03:40 AM
  7. Excel maro macro to look up a closed excel function workbook.
    By hittingtime in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2006, 10:00 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