Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 08:17 PM.

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"