PC Review


Reply
Thread Tools Rate Thread

After printing to PDFs. How do I attach them to an email?

 
 
=?Utf-8?B?Q2FsbGU=?=
Guest
Posts: n/a
 
      4th Oct 2006
I use this code to print sheets to pdf files but how do I code a VBA macro to
attach the files to an email

s = Application.ActivePrinter
For i = 1 To 9
Err.Clear
On Error Resume Next
Application.ActivePrinter = "Adobe PDF på Ne0" & i & ":"
If Err.Number = 0 Then Exit For
On Error GoTo 0
Next
On Error GoTo 0
Worksheets("Kund data").PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF på Ne0" & i & ":", Collate:=True
Worksheets("Schakt dörr").PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF på Ne0" & i & ":", Collate:=True
Worksheets("Korg dörr").PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF på Ne0" & i & ":", Collate:=True

Application.ActivePrinter = s

I have tried this script but you have to define the name of the pdf. Is
there anyway to get the macro to know what file names and filepaths the new
pdfs I just created have?

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String
Dim cell As Range

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

With OutMail
..To = ""
..CC = ""
..BCC = ""
..Subject = ""
..Attachments.Add ("C:\wittur\offert.pdf")
..Body = strbody
..Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      4th Oct 2006
I don't have acrobat installed here, so I can't test it and tell - also,
Acrobat seems to have multiple ways to do this. In any event, this is an oft
discussed topic, so you might look here and see if you can find something
that helps:

http://tinyurl.com/q8fyd

--
Regards,
Tom Ogilvy


"Calle" wrote:

> I use this code to print sheets to pdf files but how do I code a VBA macro to
> attach the files to an email
>
> s = Application.ActivePrinter
> For i = 1 To 9
> Err.Clear
> On Error Resume Next
> Application.ActivePrinter = "Adobe PDF på Ne0" & i & ":"
> If Err.Number = 0 Then Exit For
> On Error GoTo 0
> Next
> On Error GoTo 0
> Worksheets("Kund data").PrintOut Copies:=1, ActivePrinter:= _
> "Adobe PDF på Ne0" & i & ":", Collate:=True
> Worksheets("Schakt dörr").PrintOut Copies:=1, ActivePrinter:= _
> "Adobe PDF på Ne0" & i & ":", Collate:=True
> Worksheets("Korg dörr").PrintOut Copies:=1, ActivePrinter:= _
> "Adobe PDF på Ne0" & i & ":", Collate:=True
>
> Application.ActivePrinter = s
>
> I have tried this script but you have to define the name of the pdf. Is
> there anyway to get the macro to know what file names and filepaths the new
> pdfs I just created have?
>
> Dim OutApp As Outlook.Application
> Dim OutMail As Outlook.MailItem
> Dim strbody As String
> Dim cell As Range
>
> Set OutApp = CreateObject("Outlook.Application")
> Set OutMail = OutApp.CreateItem(olMailItem)
>
> With OutMail
> .To = ""
> .CC = ""
> .BCC = ""
> .Subject = ""
> .Attachments.Add ("C:\wittur\offert.pdf")
> .Body = strbody
> .Display
> End With
> Set OutMail = Nothing
> Set OutApp = Nothing

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing pdfs Ryka Windows Vista General Discussion 21 5th Jan 2009 09:44 PM
Printing OLE PDFs Perplexed by pdfs Microsoft Access Reports 2 23rd Jan 2008 12:06 AM
Images in PDFs and PPT not printing out =?Utf-8?B?SmltYm8=?= Windows Vista Print / Fax / Scan 0 5th Oct 2007 11:08 PM
Printing PDFs cj Microsoft VB .NET 8 20th Apr 2007 07:41 PM
Is there a way to directly attach emails or email attach to access d Microsoft Access 1 6th Jul 2004 02:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:21 AM.