Results 1 to 6 of 6
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    VBA to MS Outlook - set paragraph 'SpaceAfter' property

    have this line of code to setup an email in outlook...
    Code:
    With objMail
                    .To = varAddress & ""
                    .Subject = Nz(varSubject, "")
                    .HTMLBody = "<span style='font:calibri, font-size:11pt;'>" & Nz(varBody, "") & Format(Now) & "<\span>"
                    .Body = Nz(varBody, "")
                    .Save
                    .Display
                End With
    the nuance is that the default paragraph format for SpaceAfter and SpaceBefore is AUTO (which seems default to half of the font's point size);

    -->what I been asked repeatedly is to change the spacing to be 0pt for both before and after
    would you be able to direct me on how include that instruction to the above (plz) ?



    as always, with thnx in advance,
    m.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    The default Before and After for me is 0.

    Might be able to control this with HTML tags. https://stackoverflow.com/questions/...y-line-spacing
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    tried revising the line to be
    Code:
    .HTMLBody = "<span style='font:calibri, font-size:11pt, Paragraph.SpaceAfter = 0, Paragraph.SpaceBefore = 0;'>" & Nz(varBody, "") & Format(Now) & "<\span>"
    still comes back: AUTO (which - for us... has space before and after)

    also tried commenting out the line (as had been done in your link (thnx)) - same issue remained

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Searched for explanation of why my default is 0 not Auto. Possibly this is managed by NormalEmail.dotm template saved with user profile. If there is no template then I suppose Outlook has to fall back on it's general defaults.

    I've found several old threads on this same question. There were no responses or none that had solution.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    well, it's always nice to know when you are not alone in the world

    THNX for the effort (much appreciated)

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,910
    So have you looked at your NormalEmail template?

    Here is mine.
    Attached Thumbnails Attached Thumbnails Paragraph.PNG  
    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

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

Similar Threads

  1. Find Paragraph Start And End Then Replace
    By DMT Dave in forum Access
    Replies: 17
    Last Post: 06-17-2021, 11:30 AM
  2. Creating a form to compile into Paragraph
    By deathnote2135 in forum Forms
    Replies: 2
    Last Post: 08-29-2018, 06:40 AM
  3. Replies: 9
    Last Post: 09-18-2015, 09:02 PM
  4. Create a paragraph using Field Values
    By imran688 in forum Access
    Replies: 12
    Last Post: 10-31-2012, 12:04 PM
  5. Paragraph
    By supatsiri in forum Reports
    Replies: 0
    Last Post: 02-06-2009, 10:05 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