Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can,t send any email..get an error message telessor Excel Programming 0 January 13th 08 10:11 PM
Send spreadsheet as email message dan Excel Discussion (Misc queries) 4 September 8th 06 10:20 PM
need macro for create new email message and send it [email protected] Excel Programming 4 July 11th 06 11:15 AM
send email message Sam Excel Programming 1 August 10th 04 10:54 PM
Send email with alert message Grey Excel Programming 11 May 23rd 04 12:41 PM


All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"