Results 1 to 6 of 6
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,195

    Switching text box for HTML Email


    Hi Again guy's this one I think maybe a long shot but here we go, if i type ie: 4 paragraphs into a text box, i want to change that top go to HTML email body.

    I can achieve that no problem using Replace(strMessage,".", "br> & "br>")

    so as long as I make sure I put a full stop at the end of each sentence or paragraph, its fine.

    If a user types 3 sentences and either accidently doesn't use full stops or in the habit of not using full stops, this wouldn't work.

    Is there a way to find more than one space ie: only 1 space between each word, for example lets say 3 spaces must mean there is another paragraph afterwards because there is only 1 space between words.

    The end of the message is fine because i can determine that by the User Name

    So in between Hello and User Name I am trying find a method where we can find the last word of the paragraph (If no Full Stops) ?

    For example if there is a method to determine there are 5 extra blank lines in the whole message, find the last word before these blank lines and either add full stop so my code works ok ?

    Or a better method if there is one ?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Dave,

    Do you have some sample texts to experiment with?

    For things like contiguous spaces you can do a repeated Replace(yourText," "," ")====replace 2 spaces with 1.

    But better to have test data that represents typical responses and look for patterns and then apply a pattern match approach to your real data. Still may need "human review".

  3. #3
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,195
    Hi Orange, thank you I am going to play around with replace function, I don't think its going to be as easy as I think but what you have suggested by replacing is a good shot

    Thanks and I will play around

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,943
    Perhaps look for CHR(13) and insert the html before that?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,195
    Hi WGM, i will give it a try, i think it's difficult to cater for human differences of input.

    Thanks a lot

  6. #6
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,195
    Got it, this does the trick, thank again guys

    for reference
    lne = ------------------------------------------------------
    wkr = "With Kind Regards
    OrgMsg is Original Message inbound
    eDisc is Email Disclaimer paragraph 1
    eDisc2 is Email Disclaimer paragraph 2


    Code:
        strMailIn = Me.txtReply        .HTMLBody = Replace(strMailIn, ".", "<br>" & "<br>") & "<br>" & "<br>" & wkr & "<br>" & "<br>" & User & "<br>" & "<br>" & _
            lne & lne & "<br>" & "Your Message" & "<br>" & "<br>" & Replace(OrgMsg, Chr(13), "<p>") & "<br>" & lne & lne & "<br>" & "<br>" & _
            "<P><IMG border=0 hspace=0 alt='' src='file://T:/Removed on forum/Email Signature.jpg' align=baseline></P>" & "<br>" & _
            "<FONT color=#0000CD>" & eDisc & "<br>" & "<FONT color =#0000CD>" & eDisc2

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-23-2015, 02:13 PM
  2. SendObject Email HTML Text
    By abodi in forum Programming
    Replies: 1
    Last Post: 09-10-2014, 12:03 AM
  3. Replies: 2
    Last Post: 08-05-2014, 02:17 PM
  4. Switching to number from text
    By ChristopherL in forum Access
    Replies: 2
    Last Post: 07-01-2013, 03:27 AM
  5. Switching Values in text box????
    By reidn in forum Forms
    Replies: 2
    Last Post: 07-08-2011, 02:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums