bradyboyy88
Well-known Member
- Joined
- Feb 25, 2015
- Messages
- 562
I keep getting error 462: The remote server does not exist or is unavailable. Any ideas?
Here is my code:
Here is my code:
Code:
Public Sub SendButton_EMAIL_Click()
'Email Declarations
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
'Set References
On Error GoTo OutlookErrors
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set OutlookEventClass.oMailItem = OutMail
With OutMail
.SentOnBehalfOfName = FromLabel_EMAIL.Caption
.To = ToTextBox_Email.Text
.CC = CCTextbox_EMAIL.Text
.BCC = BCCTextbox_EMAIL.Text
.Subject = SubjectTextbox_EMAIL.Text
.Body = BodyTextbox_EMAIL.Text
If Not AttachmenLabel_EMAIL.Tag = "" Then
.Attachments.Add (AttachmenLabel_EMAIL.Tag)
End If
.Send
End With
OutApp.Quit
Set OutMail = Nothing
Set OutApp = Nothing
OutlookErrors:
Debug.Print Err.Number & " : " & Err.Description
If Not OutMail Is Nothing Then
OutMail.Close (olDiscard)
End If
Set OutMail = Nothing
If Not OutApp Is Nothing Then
Set OutApp = Nothing
End If
Exit Sub
End Sub
Last edited: