![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
hello everyone.
I am hoping someone can help in finding a solution to this error message I keep getting with running the following code: Private Sub CommandButton1_Click() Dim xOutlookObj As Object Dim xEmail As Object Dim xDoc As Document Application.ScreenUpdating = False Set xOutlookObj = CreateObject("Outlook.Application") Set xEmail = xOutlookObj.CreateItem(olMailItem) Set xDoc = ActiveDocument xDoc.Save With xEmail .Subject = "Assessment Form" .Body = "Please find the assessment form attached. Thank you." .To = "testemailaddress@gmail.com" .Importance = olImportanceNormal .Attachments.Add xDoc.FullName .Display End With Set xDoc = Nothing Set xEmail = Nothing Set xOutlookObj = Nothing Application.ScreenUpdating = True End Sub ***Note: I don't have outlook on the computer I am using. I do have Mail and other email apps. Is there a way I can at least test my save and submit button by using other email other than outlook? thank you |
#2
|
||||
|
||||
![]()
Does this post help?
email - How to send e-mail through VBA without Outlook - Stack Overflow
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
![]()
hello, thank for your response.
I apologize in advance for the stupid question. For the code your referred me to, where do I enter my info exactly? what is the syntax? Function email(ByVal sender_email As String, _ ByVal email_message As String, _ ByVal email_message2 As String, _ ByVal reply_address As String, _ ByVal sender_name As String) Dim Mail As New Message Dim Cfg As Configuration Set Cfg = Mail.Configuration 'SETUP MAIL CONFIGURATION FIELDS Cfg(cdoSendUsingMethod) = cdoSendUsingPort Cfg(cdoSMTPServer) = 'SMTP Cfg(cdoSMTPServerPort) = 'SMTPport Cfg(cdoSMTPAuthenticate) = cdoBasic Cfg(cdoSMTPUseSSL) = True Cfg(cdoSendUserName) = 'sender_email Cfg(cdoSendPassword) = 'password Cfg.Fields.Update 'SEND EMAIL With Mail .From = 'sender_name & sender_email .ReplyTo = 'reply_address .To = 'receiver .CC = 'carbonCopy .BCC = 'blindCopy .Subject = 'SubjectLine .HTMLBody = 'email_message & email_message2 .Attachments.Add attFilePath .Send End With for instance, this line: Cfg(cdoSMTPServerPort) = 'SMTPport do I remove the ' and enter the SMTPport details?...is there some sort of code to get the SMTPport address? for this line: Cfg(cdoSendUserName) = 'sender_email do I simply remove the ' and enter the sender's email address? |
#4
|
||||
|
||||
![]()
SMTPPort is the SMPT Port associated with your e-mail account. You can get this from your service provider.
Cfg(cdoSMTPServer) is the SMTP server name Sender_email is the address associated with the same account The rest are, I think, self explanatory.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
![]()
yes. thank you. I figured that all out. the only issue now is that I keep getting a transport error 0X80040217...server response not available
so, now trying to figure that out. |
![]() |
Tags |
help please, run-time error 429, send form by email |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting Run Time error 429: ActiveX Control can't create object | sampritiagarwal | Excel Programming | 0 | 08-03-2021 09:25 PM |
VBA to create a button to attach the active word doc to an email as a PDF without using Outlook | TAKMalcolm | Word VBA | 1 | 09-21-2017 01:52 AM |
![]() |
Katherine1995 | Word VBA | 6 | 11-17-2016 12:04 PM |
![]() |
zlodeh | Excel Programming | 1 | 02-24-2016 01:58 AM |
![]() |
Doug Needham | Excel Programming | 4 | 01-12-2015 10:54 PM |