Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Sending emailswith CDO

The following code below uses Outlook and I get that popup
saying A program is sending email on your behalf. Is
there anyway to convert the following code to do exactly
what it does now, just send using CDO where that message
does not pop up? Thank you.

Private Sub CommandButton2_Click()
Dim ol As New Outlook.Application
Dim olmail As MailItem
Dim cell As Range, cell2 As Range
Dim shRng As Range
Dim sh As Worksheet, sharr() As String
Dim wb As Workbook
Dim i As Integer

Set sh = ThisWorkbook.Sheets("Team Management Database")
i = 1
Set ol = New Outlook.Application

For Each cell In sh.Range("a3", Range("a3").End(xlDown))
Set shRng = cell.Offset(0, 9)
ReDim sharr(1 To shRng.Offset(0, 50).End
(xlToLeft).Column - _
shRng.Column + 1)

For Each cell2 In sh.Range(shRng, shRng.Offset(0,
50).End(xlToLeft))
sharr(i) = cell2.Value
i = i + 1
Next cell2

ThisWorkbook.Sheets(sharr).Copy
Set wb = ActiveWorkbook
wb.SaveAs Filename:="C:\Sheets.xls"

Set olmail = ol.CreateItem(olMailItem)
With olmail
.To = cell.Offset(0, 2).Value
.Subject = "Your Stats"
.Body = "Here are your stats, " & cell.Offset(0,
1).Value
.Attachments.Add wb.Path & "\" & wb.Name
.Display
.Send
End With

wb.Close savechanges:=False
i = 1
Kill "c:\sheets.xls"
Next cell
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
sending excel Pammy Excel Discussion (Misc queries) 2 October 7th 08 04:05 PM
Sending via Excel Dan Excel Discussion (Misc queries) 0 June 19th 07 04:18 PM
Sending Info jsnider Excel Worksheet Functions 2 October 15th 05 08:25 PM
sending questions ajimmo Excel Discussion (Misc queries) 0 June 17th 05 12:45 AM
Sending messages Ron de Bruin Excel Programming 0 September 21st 03 08:43 AM


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