Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-05-2020, 02:46 PM
PrincessApril PrincessApril is offline Place Cursor in multiline HTML Body Windows 10 Place Cursor in multiline HTML Body Office 2019
Competent Performer
Place Cursor in multiline HTML Body
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default Place Cursor in multiline HTML Body

Hi all. I am using the below code to generate an html email with the default signature in outlook. The output is great; however, the cursor does not appear until I tab or click in a field other than the body and then tab/click back into the body. I would like the cursor to appear two lines below the salutation. Any ideas on how to place the cursor, preferably without using sendkeys?



Code:
Private Sub EmailBtnUnits2020_Click()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim StrBody As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    StrBody = "<html><body><font size=""3"" face=""Calibri"" color=""black""><p>Hi " & ActiveSheet.Range("W4").Text & ",</p>" _
    & "</font></body></html>"

    On Error Resume Next

    With OutMail
        .Display
        .To = ActiveSheet.Range("AC4").Text
        .CC = ""
        .BCC = ""
        .Subject = "Question"
        .HTMLbody = StrBody & "<br>" & .HTMLbody
        .Display
    End With

    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
Reply With Quote
 

Tags
cursor, email, multiple lines



Similar Threads
Thread Thread Starter Forum Replies Last Post
Place Cursor in multiline HTML Body Pasted pictures go all over the place, not at the cursor WaltR Word 9 09-20-2013 05:58 PM
Can't Place Cursor to Insert Subdocument ForWork Word 4 03-08-2013 03:10 AM
Place cursor below msg body in reply charles.h Outlook 0 10-03-2009 03:05 AM
Replying to a message and having the cursor go into the body join_the_band Outlook 1 12-02-2005 06:21 AM
HTML Format Body - Scripts? jeffcravener Outlook 0 11-14-2005 10:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft