Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send excel or csv through email

Status
Not open for further replies.

barnard89

MIS
Joined
Mar 6, 2005
Messages
74
Location
US
Hi
I am using Excel 2000
I have written code in excel vba to automatically send a csv file
through email (Microsoft outlook)

I would like to save the excel file as a csv file and then send the csv file through email

This is the code I am writing




ActiveWorkbook.SaveAs Filename:="c:\Data\Inv_Costs.csv", FileFormat:=xlCSV, _
CreateBackup:=False

ActiveWorkbook.HasRoutingSlip = True
With ActiveWorkbook.RoutingSlip
.Recipients = Array("r_brown@ibm.com", _
"j_hudson@ibm.com")
.Subject = "Inventory Costs"
.Message = "Inventory Costs Spread sheet"
.Delivery = xlAllAtOnce
.ReturnWhenDone = False
.TrackStatus = False
End With
ActiveWorkbook.Route

ActiveWorkbook.Close




I would like to send the file as a CSV attachment
However the file is going as a XLS attachment
Can any one please correct my code

thanks

 


The key word in your post is Active[red]Workbook[/red]

Guess what? A .csv file is NOT a workbook.

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 

SkipVought

Thanks fot them post.

Now , what would be the remedy

How can I send this as a CSV ?
Can you correct my code and send it back
 


I would guesss that you'ld have to instantiate a Mail object using the GetObject method and Attach your .csv file that way.

This is an involved approch. You must set a reference to the Mail Library (whatever eMail system you use) in your VB Project. Depending on the application objects available in that application, you may be able to attach a file.

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top