Send one tab of workbook in email

  • Thread starter Thread starter LKP
  • Start date Start date
L

LKP

Hi-

I have a macro in a workbook right now that send an email with the enitre
wookbook attached to it. I was wondering if there was a way to have a mcro
that would just attach one tab of the workbook to the email. I think this
is the relevant part of my current macro:


'Make a copy of the file/Open it/Mail it/Delete it
'If you want to change the file name then change only TempFileName
TempFilePath = Environ$("temp") & "\"
TempFileName = "Copy of " & wb1.Name & " " & Format(Now, "dd-mmm-yy
h-mm-ss")
FileExtStr = "." & LCase(Right(wb1.Name, Len(wb1.Name) -
InStrRev(wb1.Name, ".", , 1)))

wb1.SaveCopyAs TempFilePath & TempFileName & FileExtStr
Set wb2 = Workbooks.Open(TempFilePath & TempFileName & FileExtStr)

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
 
Since you mention a "workbook", I suspect you're looking for help with
Excel...

This newsgroup supports MS Access, the relational database.

Try posting in an Excel newsgroup.


--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Back
Top