EnterFieldBehaviour

stirlingmw

Board Regular
Joined
Feb 18, 2013
Messages
75
Morning all

Is there a way that when data is been added to a Userform Textbox and Return is pressed to start a new line that ";" is added to the end of the previous line?

The reason i am asking is the data being added are multiple email addresses and when these are added to the new email via the following code i would like the appropriate separator to be added.

Code:
Private Sub EmailDESTeam_Click()
Dim xOutApp As Object
    Dim xOutMail As Object
    Dim xMailBody As String
    On Error Resume Next
    Set xOutApp = CreateObject("Outlook.Application")
    Set xOutMail = xOutApp.CreateItem(0)
    xMailBody = ""
                  On Error Resume Next
    With xOutMail
        .To = TxtDESTeam.value & TxtDESLead.value
        .CC = TxtDESLead.value
        .BCC = ""
        .Subject = Format(Date, "yyyymmdd") & "-" & TxtProject.value & "-OS"
        .Body = vbLf & _
        "Please find the link below to the MCM CDT Project Tracker" & vbLf & vbLf & _
        "You are being sent this email as you have been associated with the " & TxtProject.value & " Project." & vbLf & vbLf & " You are requested to nominate one of your team to update this          project on a weekly basis." & vbLf & vbLf & _
        "This nominated person is to annotate their email address into the 'Nominated DE&S Member' textbox. This person will receive weekly update reminders" & vbLf & vbLf & _
        "xxxxxxxxxxxxxxxxx"
        .Display
    End With
    On Error GoTo 0
    Set xOutMail = Nothing
    Set xOutApp = Nothing


End Sub

Thanks

Steve
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Something like this maybe:

Code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

TextBox1.MultiLine = True

If KeyCode = 13 Then
    TextBox1.Value = TextBox1.Value & ";" & Chr(10)
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top