LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default After printing to PDFs. How do I attach them to an email?

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
 
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
how to attach doc.to an email? Pam B. New Users to Excel 1 February 15th 10 05:08 AM
attach outlook email rwtrader Excel Discussion (Misc queries) 1 April 6th 09 10:49 PM
how do I attach spreadsheet in email fotomaxi Excel Worksheet Functions 2 March 3rd 09 02:53 AM
Printing one Adobe pdf instead of multiple pdfs universal[_27_] Excel Programming 1 April 7th 04 01:16 PM
attach to email Eric[_11_] Excel Programming 2 August 26th 03 07:56 PM


All times are GMT +1. The time now is 02:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"