KIMBO
10-08-2001, 06:52 AM
when i try to use the mail as attachment command i get : access cant open the mail session.... "mailto" boots express ok... but i cant send attachment.......HELP...PRETY PLEASE
|
View Full Version : mail an attachment??? KIMBO 10-08-2001, 06:52 AM when i try to use the mail as attachment command i get : access cant open the mail session.... "mailto" boots express ok... but i cant send attachment.......HELP...PRETY PLEASE BukHix 10-08-2001, 07:16 AM I am not sure about doing it with a macro but it could be handled with code like this. All you need to do is put this code behind a command button. Also you will want to modify the attachments path. If you need more help with that just let me know. Dim EmailApp, NameSpace, EmailSend As Object Set EmailApp = CreateObject("Outlook.Application") Set NameSpace = EmailApp.getNameSpace("MAPI") Set EmailSend = EmailApp.CreateItem(0) EmailSend.To = "emailaddress@here.com" ' Put email address here EmailSend.Subject = "Here is your attachment" EmailSend.Body = "This is the file you needed today" EmailSend.Attachments.Add "c:\testfile.xls" ' Change this to match your path EmailSend.Display ' Remove this line if you don't want to see email Set EmailApp = Nothing Set NameSpace = Nothing Set EmailSend = Nothing [This message has been edited by BukHix (edited 10-08-2001).] KIMBO 10-08-2001, 01:39 PM ok buk we'll do it here.... and thanks again BukHix 10-08-2001, 01:45 PM I am not sure how that will work with Outlook Express but I think you will be OK. Let me know, if not we can modify it as needed. Open your form in design mode and add a command button. Right click on the button and choose properties. From there you choose Events and select on On_Click. You can cut and paste the code directly into the code window as it appears. The only modification you will have to make is the path and file name. If these has to be dynamic you could also get that from text boxes on a form or something similar. KIMBO 10-08-2001, 02:47 PM hi again... tried it...dont work.. i get error at line *Set EmailApp = CreateObject("Outlook.Application:")* ps as i said i'm trying to mail an access report from a command button in the same database....is this a problem? i can make the report output to a file first but this seems a bit inelegant as i want to bring in the report again at the recipients' end. |