Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send an email message from my website using VBA code
I have an excel file on my website that customers can open to receive
activation numbers. After the VBA code gives the activation number, I need the VBA code to send an email to my address. Can someone show me sample VBA code to open a new email, add the address, Subject, and message and send the message. Any help would greatly appreciated. -- Larry |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send an email message from my website using VBA code
Ron has a section on his web site that deals with email.
http://www.rondebruin.nl/tips.htm "Larry" wrote in message ... I have an excel file on my website that customers can open to receive activation numbers. After the VBA code gives the activation number, I need the VBA code to send an email to my address. Can someone show me sample VBA code to open a new email, add the address, Subject, and message and send the message. Any help would greatly appreciated. -- Larry |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send an email message from my website using VBA code
Thank you for giving me the website. On Ron's website I found the VBA code
as shown below. I added it to my excel file with the changes so to write the information I need to the email. QUESTION: The excel file will be on my website and the VBA code requires OUTLOOK. Will every customer who enters my website need OUTLOOK before the VBA code can send me an email? What change to the VBA code do I need to make so it will work on the website. Thank you very much for your help. See sample code below. Sub Mail_small_Text_Outlook() ' Is working in Office 2000-2007 Dim OutApp As Object Dim OutMail As Object Dim strbody As String Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) Customer1= cells(2,3) Date1=cells(2,4) strbody = "Customer " & Customer1 & "received their activation code " & Date1 On Error Resume Next With OutMail .To = " .CC = "" .BCC = "" .Subject = "This is the Subject line" .Body = strbody .Display 'or use .Send End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub -- Larry "JLGWhiz" wrote: Ron has a section on his web site that deals with email. http://www.rondebruin.nl/tips.htm "Larry" wrote in message ... I have an excel file on my website that customers can open to receive activation numbers. After the VBA code gives the activation number, I need the VBA code to send an email to my address. Can someone show me sample VBA code to open a new email, add the address, Subject, and message and send the message. Any help would greatly appreciated. -- Larry |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send an email message from my website using VBA code
I have tried two of Ron's sample VBA codes in my excel file located on my
website. The first sample uses OutLook and the second code uses SendMail. I tried both, but no email is created and sent. I have included the first code on my previous response and I have included the second code below for review. Can someone tell me what changes I need to make to the code. I am running VISTA. The excel file is saved in office 2000 formate and I am running on office 2007. Thank you for any help you can give. Larry My e-mail is dietbook95@hotmail. SAMPLE CODE: Sub Mail_Sheets() 'Working in 97-2007 Dim wb As Workbook Dim Shname As Variant Dim Addr As Variant Dim N As Integer Dim TempFilePath As String Dim TempFileName As String Dim FileExtStr As String Dim FileFormatNum As Long Shname = Array("Sheet1", "Sheet1") Addr = ", ") If Val(Application.Version) = 12 Then 'You run Excel 2007 FileExtStr = ".xlsm": FileFormatNum = 52 Else 'You run Excel 97-2003 FileExtStr = ".xls": FileFormatNum = -4143 End If With Application .ScreenUpdating = False .EnableEvents = False End With TempFilePath = Environ$("temp") & "\" 'Create the new workbooks/Mail it/Delete it For N = LBound(Shname) To UBound(Shname) TempFileName = "Sheet " & Shname(N) & " " & Format(Now, "dd-mmm-yy h-mm-ss") ThisWorkbook.Sheets(Shname(N)).Copy Set wb = ActiveWorkbook With wb .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormatNum On Error Resume Next .SendMail Addr(N), _ "This is the Subject line" On Error Resume Next .Close SaveChanges:=False End With Kill TempFilePath & TempFileName & FileExtStr Next N With Application .ScreenUpdating = True .EnableEvents = True End With End Sub -- Larry "Larry" wrote: From my excel file on my website. Can I have my VBA code open Windows Mail for my customers? Most customers will have Windows Mail, but may not have LookLook. Can you help me with code to open windows mail and send a message? THANK YOU. -- Larry "JLGWhiz" wrote: Ron has a section on his web site that deals with email. http://www.rondebruin.nl/tips.htm "Larry" wrote in message ... I have an excel file on my website that customers can open to receive activation numbers. After the VBA code gives the activation number, I need the VBA code to send an email to my address. Can someone show me sample VBA code to open a new email, add the address, Subject, and message and send the message. Any help would greatly appreciated. -- Larry |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can,t send any email..get an error message | Excel Programming | |||
Send spreadsheet as email message | Excel Discussion (Misc queries) | |||
need macro for create new email message and send it | Excel Programming | |||
send email message | Excel Programming | |||
Send email with alert message | Excel Programming |