email notification sent from specific email

Babynod

Board Regular
Joined
Aug 10, 2022
Messages
56
Office Version
  1. 365
Platform
  1. Windows
HI All

my existing login register is working perfectly thanks to all the help of people on this forum. now though i have a new email setup specificly to send the email notifications from as i now have multiple registers running

my current code is

VBA Code:
Private Sub cmdEdit_Click()

    Dim xOutApp     As Object
    Dim xOutMail    As Object
    Dim msgvalue    As VbMsgBoxResult

    On Error GoTo myerror

    msgvalue = MsgBox("Do you want To save the data?", vbYesNo + vbInformation, "confirmation")

    If msgvalue = vbNo Then Exit Sub

    If ValidateEmptyEntries() = True Then
        Call Edit
        Call reset
    Else
        Err.Raise 600, , "duplicate validation failed or empty field must be filled"
    End If
    
     cmdEdit.Enabled = False
     cmdSubmit.Enabled = True
     txtUser.Enabled = True

    'email notification

    Set xOutApp = CreateObject("Outlook.Application")
    Set xOutMail = xOutApp.CreateItem(0)

    With xOutMail
        .To = "MarkP@example.com.au"
        .CC = ""
        .BCC = ""
        .Subject = "WMS LOGIN REGISTER"
        .Body = "Account Update Requested By " & (Application.UserName)
        .Send
    End With

myerror:
    Set xOutMail = Nothing
    Set xOutApp = Nothing

End Sub

which part would i have to edit to add in the new FROM email? as its no longer going to be my default email address? LoginRegisters@example.com.au
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Thank you Babynod,

I was just about to start looking for something like this.
 
Upvote 0
Sorry Babynod. I am not as experienced as many of the folk on tis messageboard.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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