Simple email script (1 Viewer)

grumpy_whale

New member
Local time
Yesterday, 19:08
Joined
Aug 3, 2017
Messages
2
So all i need is a little help with email, i have a set of scripts that run and at the end i just want a simple email to be generated, to a single set of people to say its completed. The list is static. Ive tried a couple of scripts but it keeps saying missing parts. Does anyone have example scripts i could insert.
I dont want it to be fully automated still want to be able to press the send when ready after checks.
 

grumpy_whale

New member
Local time
Yesterday, 19:08
Joined
Aug 3, 2017
Messages
2
Thank you for the quick reply, that looks to be what i need, it is only a simple mail i need.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:08
Joined
May 7, 2009
Messages
19,232
'
' usage vSuccess = Email1("rick.grimes@TWD.com","subject", "body text", "c:\folder\file.zip")

Public Function Email1(ByVal pvTo, ByVal pvSubj, ByVal pvBody, optional ByVal pvFile) As Boolean
Dim oApp As Outlook.Application
Dim oMail As Outlook.MailItem

On Error GoTo ErrMail

'NOTE BE SURE YOU ADD OUTLOOK APP VIA VBE menu:TOOLS, REFERENCES

Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(olMailItem)

With oMail
.To = pvTo
.Subject = pvSubj
.Body = pvBody

if not isempty(pvFile) then .Attachments.Add pvFile, olByValue, 1
.Send
End With

Email1 = True
Set oMail = Nothing
Set oApp = Nothing
Exit Function

ErrMail:
MsgBox Err.Description, vbCritical, Err
''Resume Next
End Function
 

Users who are viewing this thread

Top Bottom