Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
E-Mail attachments
I am trying to write and e-Mail with an attachment pointing to another file.
When I run this code, it tells me it is running; but when I look in the folder, I have an empty folder. I am submitting the code for anyone can tell me why I am having problems. Thank you any assistance someone can give me. Sub SendWithAtt() Dim olApp As Outlook.Application Dim olMail As MailItem Dim olAttach As Attachment Dim olFolder As Outlook.MAPIFolder Dim olNameSpace As Outlook.Namespace Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) Set olNameSpace = olApp.GetNamespace("MAPI") Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox) With olMail .To = " .CC = "" .BCC = "" .Subject = "Transmission of Special Item Inventory File" .Body = "The Special Item Inventory File is now being transmitted." If Len("c:\Inventory\Transmit\TransInv.mdb") < 0 Then For Each olAttach In olMail.Attachments olAttach.SaveAsFile "c:\Prod\Data\Inventory\" & olAttach.Filename Next Else 'Note: Place here messages that the files doesn't exists End If .Display .Send End With Set olMail = Nothing Set olApp = Nothing Set olAttach = Nothing Set olFolder = Nothing Set olNameSpace = Nothing End Sub -- Larry E. Brueshaber |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
E-Mail attachments
I can not comment your code. But take a look at
http://www.rondebruin.nl/sendmail.htm Hopefully the example code will help you further! Martin "Larry" wrote: I am trying to write and e-Mail with an attachment pointing to another file. When I run this code, it tells me it is running; but when I look in the folder, I have an empty folder. I am submitting the code for anyone can tell me why I am having problems. Thank you any assistance someone can give me. Sub SendWithAtt() Dim olApp As Outlook.Application Dim olMail As MailItem Dim olAttach As Attachment Dim olFolder As Outlook.MAPIFolder Dim olNameSpace As Outlook.Namespace Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) Set olNameSpace = olApp.GetNamespace("MAPI") Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox) With olMail .To = " .CC = "" .BCC = "" .Subject = "Transmission of Special Item Inventory File" .Body = "The Special Item Inventory File is now being transmitted." If Len("c:\Inventory\Transmit\TransInv.mdb") < 0 Then For Each olAttach In olMail.Attachments olAttach.SaveAsFile "c:\Prod\Data\Inventory\" & olAttach.Filename Next Else 'Note: Place here messages that the files doesn't exists End If .Display .Send End With Set olMail = Nothing Set olApp = Nothing Set olAttach = Nothing Set olFolder = Nothing Set olNameSpace = Nothing End Sub -- Larry E. Brueshaber |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sending Templates as e-mail Attachments? | Excel Discussion (Misc queries) | |||
E-mail Multiple Attachments | Excel Programming | |||
Blocked e-mail attachments | Excel Programming | |||
Creating TWO-WAY E-Mail Attachments with 'BeforeSave Events' in Code for 2nd E-Mail | Excel Programming | |||
E-mail Attachments | Excel Programming |