Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have the below coding however it keeps returning a bug. I am adding it to the tail end of an error trapping function. However I can't get it working on it's own never mind at the end of the original coding. The rest works fine, just not this bit. I want to send a newly saved copy to a specific address, including ranges in the new saved name, however I can't includ the date nor will it send.?? Can anyone help? Thanks Craig Public Function Open_mail() Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdate & Range("B13").Value & Range("B14").Value Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "Credit Card Form" & Range("B13").Value & Range("B14").Value .Body = "This is a test... help!" .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") '.Display .Send 'or use .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Function |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Craig,
Your code (or Ron de Bruin's code!) worked for me, as is. I merely changed to mail adress and explicitly dimmed the variables - but these steps should not affect the functionality of the code. Perhaps your (undisclosed) error pertains to the calling code? --- Regards, Norman wrote in message ups.com... Hi All, I have the below coding however it keeps returning a bug. I am adding it to the tail end of an error trapping function. However I can't get it working on it's own never mind at the end of the original coding. The rest works fine, just not this bit. I want to send a newly saved copy to a specific address, including ranges in the new saved name, however I can't includ the date nor will it send.?? Can anyone help? Thanks Craig Public Function Open_mail() Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdate & Range("B13").Value & Range("B14").Value Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "Credit Card Form" & Range("B13").Value & Range("B14").Value .Body = "This is a test... help!" .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") '.Display .Send 'or use .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
General mail failure when sending e-mail from Excel | Excel Discussion (Misc queries) | |||
Sending E-mail | Excel Programming | |||
Sending E-mail | Excel Worksheet Functions | |||
Help sending mail... | Excel Programming |