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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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