Results 1 to 9 of 9
  1. #1
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200

    New Line in VBA Script

    I have a button on my form that opens a new outlook email, and populates the body with data. I want to use a carriage return to seperate the text strings. I am using the keyword "vbNewLine", and while it creates a new line, the cursor can't "click" into that blank line...almost like "vbNewLine & vbNewLine" did a double space. I don't want this because of the formatting that results on the receiver's end...sometimes the spaces are removed. Are there any other key words I could use that would follow the behaviour of the enter key?

    Code:
    .Body = "My Text String" & vbNewLine & vbNewLine & "Second Text String On New Line"


  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would try vbCrLf which is a Carriage Return and then a Line Feed. ^M^J

  3. #3
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    So would that be something like this?

    Code:
    "FirstParagraphString" & vbCrLF & vbNewLine & "SecondParagraphString"

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Experiment a bit.

  5. #5
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    I tried it, and it works....however, I'm getting the same result. For example, if I place the cursor at the end of the first line, and hit the Down Arrow button, it doesn't move the cursor into the space, it just completely skips it. I don't want this because the email received with some email providers removes that blank space

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about putting just a period on that line?
    .
    .

  7. #7
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    I don't want that in the email though. Maybe I could use " "? I was just wondering if there was a VBA keyword I might have been missing. But it seems like they all basically have the same result.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Good luck on your quest.

  9. #9
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    Thank you.

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

Similar Threads

  1. Replies: 7
    Last Post: 04-11-2011, 03:58 PM
  2. Database script
    By kleclark in forum Programming
    Replies: 2
    Last Post: 02-15-2011, 11:50 AM
  3. How to do line by line compare of VB code?
    By Buakaw in forum Access
    Replies: 2
    Last Post: 02-14-2011, 11:46 PM
  4. Replies: 5
    Last Post: 12-06-2010, 10:15 AM
  5. Login Script
    By theITguy in forum Access
    Replies: 2
    Last Post: 03-06-2009, 03:37 AM

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