Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to Email Attachment

I have a macro that emails monthly reports to several department heads.

Does anyone know if there is a way to prevent the message "A program i
tyring to automatically send email on your behalf ... if this i
unexpected it could be a virus" ?

I have to press "yes" each time, and the macro sends reports to man
addresses.

I understand the need for this security, however I would think there i
some way to advise the computer "it's okay, it's me".

Any assistance would be appreciated.

The code I use follows:

Sub SendReports()


Dim ol As Object, myItem As Object
Set ol = CreateObject("outlook.application")


MyText = Range("Email_Comment").Value



Set myItem = ol.CreateItem(olMailItem)
myItem.To = "email address"
myItem.Subject = "Subject Line"
myItem.Body = MyText
myItem.Body = myItem.Body & "" & Chr(13) & Chr(13)

Set myAttachments = myItem.Attachments
myAttachments.Add "Path name of file to attach"
myItem.Send


' Other addresses and attachments are entered here

Set ol = Nothing


End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default VBA to Email Attachment

Jim, I think this would be set in outlook and not excel, I don't use
outlook, but in outlook express there is a option under tools options
security, that has warn me when other applications try to send mail, if you
uncheck it you will not get the message, maybe outlook has something like
this

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"Jim Palmer " wrote in message
...
I have a macro that emails monthly reports to several department heads.

Does anyone know if there is a way to prevent the message "A program is
tyring to automatically send email on your behalf ... if this is
unexpected it could be a virus" ?

I have to press "yes" each time, and the macro sends reports to many
addresses.

I understand the need for this security, however I would think there is
some way to advise the computer "it's okay, it's me".

Any assistance would be appreciated.

The code I use follows:

Sub SendReports()


Dim ol As Object, myItem As Object
Set ol = CreateObject("outlook.application")


MyText = Range("Email_Comment").Value



Set myItem = ol.CreateItem(olMailItem)
myItem.To = "email address"
myItem.Subject = "Subject Line"
myItem.Body = MyText
myItem.Body = myItem.Body & "" & Chr(13) & Chr(13)

Set myAttachments = myItem.Attachments
myAttachments.Add "Path name of file to attach"
myItem.Send


' Other addresses and attachments are entered here

Set ol = Nothing


End Sub


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default VBA to Email Attachment

Jim,
you'll need a utility to circumvent this outlook object model protection

see: http://www.dimastr.com/redemption




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Jim Palmer wrote:

I have a macro that emails monthly reports to several department
heads.

Does anyone know if there is a way to prevent the message "A program
is tyring to automatically send email on your behalf ... if this is
unexpected it could be a virus" ?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA to Email Attachment

Ron de Bruin has an approach that uses CDO rather than you mail software.
See his discussion at his site:

Ron de Bruin's site

http://www.rondebruin.nl/sendmail.htm
http://www.rondebruin.nl/index.html

an Article by Ron on MSDN:
http://msdn.microsoft.com/library/en...odc_xlmail.asp

The index should lead you there. The article is for interest although not
particularly directly appropriate.

--
Regards,
Tom Ogilvy

"Jim Palmer " wrote in message
...
I have a macro that emails monthly reports to several department heads.

Does anyone know if there is a way to prevent the message "A program is
tyring to automatically send email on your behalf ... if this is
unexpected it could be a virus" ?

I have to press "yes" each time, and the macro sends reports to many
addresses.

I understand the need for this security, however I would think there is
some way to advise the computer "it's okay, it's me".

Any assistance would be appreciated.

The code I use follows:

Sub SendReports()


Dim ol As Object, myItem As Object
Set ol = CreateObject("outlook.application")


MyText = Range("Email_Comment").Value



Set myItem = ol.CreateItem(olMailItem)
myItem.To = "email address"
myItem.Subject = "Subject Line"
myItem.Body = MyText
myItem.Body = myItem.Body & "" & Chr(13) & Chr(13)

Set myAttachments = myItem.Attachments
myAttachments.Add "Path name of file to attach"
myItem.Send


' Other addresses and attachments are entered here

Set ol = Nothing


End Sub


---
Message posted from http://www.ExcelForum.com/



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 a Spreadsheet as an Email Attachment vs. Imbedded in Email billbrandi Excel Discussion (Misc queries) 1 April 3rd 08 03:44 AM
Email Attachment Dan DeCoursey Excel Discussion (Misc queries) 2 August 7th 07 03:00 PM
send wkbk as an email attachment with an email address copied from SueInAtl Excel Discussion (Misc queries) 0 May 21st 07 10:53 PM
email as attachment k1 New Users to Excel 3 March 19th 07 06:43 PM
Attachment to an email edger Excel Discussion (Misc queries) 0 February 9th 06 05:58 PM


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