Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Problems with sendmail

Hello everyone

I am trying to alter my sendmail code to send to an e-mail address as
specified in cell AO1 but cannot get it to work.

I have tried following Ron DeBruins tips for changing SendMail examples but
something is wrong.

Could someone look at my code and suggest what to do?

Regards

Kenny

Private Sub CommandButton11_Click()
' Thanks www.rondebruin.nl

Dim wb As Workbook
Dim strdate As String
Dim Shname As Variant
Dim Addr As Variant
Dim N As Integer
Dim msg, Style, Title, Response, MyString

'added
Dim Myhome As Variant

'added
Myhome = Sheets("Lists").Range("AO1")

strdate = Format(Now, "yyyy-mm-dd")
Shname = Array("Data", "Data")

'changed to "Myhome"
Addr = Array("Myhome", ")

msg = "Are you sure you want to send H.O. the database?"
Style = vbYesNo + vbQuestion + vbDefaultButton2
Title = "Caution - Last chance to abort sending e-mail"
Response = MsgBox(msg, Style, Title)
If Response = vbYes Then

Application.ScreenUpdating = False

For N = LBound(Shname) To UBound(Shname)
Sheets(Shname(N)).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name & " data back-up " _
& strdate & ".xls"
.SendMail Addr(N), _
"Defects data back-up" 'This is the subject line!
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Next N
Application.ScreenUpdating = True
Else
Exit Sub
End If


End Sub




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Problems with sendmail

Oops!

Looks like I was a bit too quick in asking for help - Changed "Myhome" to
Myhome and it worked!!!

Sorry

Kenny


"N E Body" wrote in message
...
Hello everyone

I am trying to alter my sendmail code to send to an e-mail address as
specified in cell AO1 but cannot get it to work.

I have tried following Ron DeBruins tips for changing SendMail examples

but
something is wrong.

Could someone look at my code and suggest what to do?

Regards

Kenny

Private Sub CommandButton11_Click()
' Thanks www.rondebruin.nl

Dim wb As Workbook
Dim strdate As String
Dim Shname As Variant
Dim Addr As Variant
Dim N As Integer
Dim msg, Style, Title, Response, MyString

'added
Dim Myhome As Variant

'added
Myhome = Sheets("Lists").Range("AO1")

strdate = Format(Now, "yyyy-mm-dd")
Shname = Array("Data", "Data")

'changed to "Myhome"
Addr = Array("Myhome", ")

msg = "Are you sure you want to send H.O. the database?"
Style = vbYesNo + vbQuestion + vbDefaultButton2
Title = "Caution - Last chance to abort sending e-mail"
Response = MsgBox(msg, Style, Title)
If Response = vbYes Then

Application.ScreenUpdating = False

For N = LBound(Shname) To UBound(Shname)
Sheets(Shname(N)).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name & " data back-up " _
& strdate & ".xls"
.SendMail Addr(N), _
"Defects data back-up" 'This is the subject line!
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Next N
Application.ScreenUpdating = True
Else
Exit Sub
End If


End Sub






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
SendMail Neo[_2_] Excel Programming 1 December 9th 03 07:20 PM
Problems with SendMail ? Jacob Excel Programming 0 October 23rd 03 09:28 PM
Problems with SendMail or automation of Send To Douglas Wills Excel Programming 7 October 1st 03 04:45 PM
Problems with SendMail Douglas Wills Excel Programming 1 September 24th 03 10:03 PM
SendMail and BCC Darrin Henry Excel Programming 0 September 15th 03 10:17 PM


All times are GMT +1. The time now is 08:42 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"