Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
I am using a Sub Mail_ActiveSheet_Outlook() code in VB
I am using a VB code in Excel that copies an excel sheet from a workbook,
saves it to another worksheet and then sends it via Outlook. I would like to add another attachment of an rtf file but have been unsuccessful in doing so. See code below: Sub Mail_ActiveSheet_Outlook() ' ' Mail_ActiveSheet_Outlook() ' Macro recorded 3/8/2006 by United Parcel Service ' 'You must add a reference to the Microsoft outlook Library Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy h-mm-ss") Application.ScreenUpdating = False Sheets("Daily Carrier Info - Yard").Copy Set wb = ActiveWorkbook With wb .SaveAs "Yard Status " & ThisWorkbook.Name _ & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "Outbound FTC91102" .Body = "Please see today's attached Full Outbound and Yard Status reports." .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("\\usagatla01s1002\Sear_K Mrt Share\Sears-Kmart\Daily Reporting\rptFullOutbound.rtf") .Send 'or use .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Sub The section (.Attachments.Add wb.FullName) I would think should be as follows but it doesn't work. ..Attachments.Add rtf.("\\usagatla01s1002\Sear_K Mrt Share\Sears-Kmart\Daily Reporting\rptFullOutbound.rtf") Is this possible to do??? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
I am using a Sub Mail_ActiveSheet_Outlook() code in VB
Hi Georgia girl
No problem to add a file from the network for me Are you sure the path is correct ??? -- Regards Ron de Bruin http://www.rondebruin.nl "Georgia girl" wrote in message ... I am using a VB code in Excel that copies an excel sheet from a workbook, saves it to another worksheet and then sends it via Outlook. I would like to add another attachment of an rtf file but have been unsuccessful in doing so. See code below: Sub Mail_ActiveSheet_Outlook() ' ' Mail_ActiveSheet_Outlook() ' Macro recorded 3/8/2006 by United Parcel Service ' 'You must add a reference to the Microsoft outlook Library Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy h-mm-ss") Application.ScreenUpdating = False Sheets("Daily Carrier Info - Yard").Copy Set wb = ActiveWorkbook With wb .SaveAs "Yard Status " & ThisWorkbook.Name _ & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "Outbound FTC91102" .Body = "Please see today's attached Full Outbound and Yard Status reports." .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("\\usagatla01s1002\Sear_K Mrt Share\Sears-Kmart\Daily Reporting\rptFullOutbound.rtf") .Send 'or use .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Sub The section (.Attachments.Add wb.FullName) I would think should be as follows but it doesn't work. .Attachments.Add rtf.("\\usagatla01s1002\Sear_K Mrt Share\Sears-Kmart\Daily Reporting\rptFullOutbound.rtf") Is this possible to do??? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
I am using a Sub Mail_ActiveSheet_Outlook() code in VB
Yes, the path is correct. I copied it from the window bar. I receive a
compile error - expected identifier or bracketed expression. It seems any way I try to correct it it gives another error. I wonder if it has something to do with the version? Thanks. "Ron de Bruin" wrote: Hi Georgia girl No problem to add a file from the network for me Are you sure the path is correct ??? -- Regards Ron de Bruin http://www.rondebruin.nl "Georgia girl" wrote in message ... I am using a VB code in Excel that copies an excel sheet from a workbook, saves it to another worksheet and then sends it via Outlook. I would like to add another attachment of an rtf file but have been unsuccessful in doing so. See code below: Sub Mail_ActiveSheet_Outlook() ' ' Mail_ActiveSheet_Outlook() ' Macro recorded 3/8/2006 by United Parcel Service ' 'You must add a reference to the Microsoft outlook Library Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy h-mm-ss") Application.ScreenUpdating = False Sheets("Daily Carrier Info - Yard").Copy Set wb = ActiveWorkbook With wb .SaveAs "Yard Status " & ThisWorkbook.Name _ & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "Outbound FTC91102" .Body = "Please see today's attached Full Outbound and Yard Status reports." .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("\\usagatla01s1002\Sear_K Mrt Share\Sears-Kmart\Daily Reporting\rptFullOutbound.rtf") .Send 'or use .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Sub The section (.Attachments.Add wb.FullName) I would think should be as follows but it doesn't work. .Attachments.Add rtf.("\\usagatla01s1002\Sear_K Mrt Share\Sears-Kmart\Daily Reporting\rptFullOutbound.rtf") Is this possible to do??? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Create a newworksheet with VBA code and put VBA code in the new worksheet module | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming |