Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
mariagloria
 
Posts: n/a
Default send to mail all the context

I need to send by mail all the context of a folder
something like "z:\transmission\*.*" but it doesn´t work like this. I nned
to do this becouse not always are the sema names for the files, they can
change, but I always have to send them no matters the name they have.

  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Try this for thr files in the folder C:\Data

Sub Mail_workbooks_Outlook()
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String
Dim OutApp As Object
Dim OutMail As Object

SaveDriveDir = CurDir
MyPath = "C:\Data" '<----- Change this path
ChDrive MyPath
ChDir MyPath

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"

FNames = Dir("*.xls")
Do While FNames < ""
.Attachments.Add MyPath & "\" & FNames
FNames = Dir()
Loop

.display 'or use .Send
End With

Set OutMail = Nothing
Set OutApp = Nothing
ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"mariagloria" wrote in message ...
I need to send by mail all the context of a folder
something like "z:\transmission\*.*" but it doesn´t work like this. I nned
to do this becouse not always are the sema names for the files, they can
change, but I always have to send them no matters the name they have.



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
send tomail all the context mariagloria Excel Discussion (Misc queries) 1 January 19th 05 03:09 PM
mail merge from excel Vass Excel Discussion (Misc queries) 3 January 7th 05 04:36 PM
Extract Data for Mail Merge Rashid Khan Excel Discussion (Misc queries) 7 December 24th 04 05:47 PM
Cannot "Send to -> mail recipient (as attachment)" Jack Excel Discussion (Misc queries) 2 December 18th 04 12:04 PM
Excel Send To function problem kysiow Excel Discussion (Misc queries) 1 December 10th 04 01:37 AM


All times are GMT +1. The time now is 07:30 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"