Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default E-Mailing a File as a PDF - Q

I read a recent post in creating a PDF document and was wondering a couple
of things. Code below is taken rom Ron De Bruin and e-mails a sheet called
"E-Mail" in XL format. Is it possible to tweak this to send as a PDF format?

I've tried just changing the ".xls" part below to ".pdf", it e-mails out
fine but you can't open up the file. It returns a message "it is not a
supported file or is corrupted"



Sub Mail_Report()
Dim wb As Workbook
Dim strdate As String
Dim MyArr As Variant
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
Sheets("E-Mail").Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls"
MyArr = Sheets("E-Mail").Range("BA2:BA15")
.SendMail MyArr, Sheets("E-Mail").Range("BA1").Value
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default E-Mailing a File as a PDF - Q

Hi John

Only changing the extension is not working

There are programs that you can use to create PDF files with code and attach it to the mail.
Excel 2007 can do this and the new mail add-in I create for 2007 have this option also.(not public on this moment)

See this page for code for 2007
http://www.rondebruin.nl/pdf.htm


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



"John" wrote in message ...
I read a recent post in creating a PDF document and was wondering a couple of things. Code below is taken rom Ron De Bruin and
e-mails a sheet called "E-Mail" in XL format. Is it possible to tweak this to send as a PDF format?

I've tried just changing the ".xls" part below to ".pdf", it e-mails out fine but you can't open up the file. It returns a message
"it is not a supported file or is corrupted"



Sub Mail_Report()
Dim wb As Workbook
Dim strdate As String
Dim MyArr As Variant
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
Sheets("E-Mail").Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls"
MyArr = Sheets("E-Mail").Range("BA2:BA15")
.SendMail MyArr, Sheets("E-Mail").Range("BA1").Value
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub



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
I need to import my Excel Mailing list into mailing label format. Gord Dibben Excel Discussion (Misc queries) 0 November 5th 09 10:16 PM
I need to import my Excel Mailing list into mailing label format. Lyn Excel Discussion (Misc queries) 0 November 5th 09 08:11 PM
Sri NEED HELP - AUTO MAILING THE FILE WHILE CLOSING Sriram Excel Programming 2 August 11th 06 10:45 AM
mailing whole excel file as an attachment. CJ Excel Discussion (Misc queries) 1 April 13th 05 03:24 PM
e-mailing a file from vba Paula Osheroff Excel Programming 1 October 8th 03 05:50 PM


All times are GMT +1. The time now is 04:20 AM.

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"