Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default Email one worksheet to email address on worksheet

Hi all,

I am using Excel 2007. I have a worksheet that I want to email via a
PDF file (I already downloaded the add-in) to the customer that is
listed in cell C5 of this worksheet. I took a look at Ron de Bruin's
site, but I don't know how to tailor the code specifically to email
the sheet to the customer listed on it.

Here is my code:

Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or
range.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim FilenameStr As String

If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE"
_
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <
"" Then

FilenameStr = Application.DefaultFilePath & "\" & _
Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False

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

strbody = "Hi there," & vbNewLine & vbNewLine & _
"Please see the attached PDF file for quote" & vbNewLine &
_
vbNewLine & "Thank you"

On Error Resume Next
With OutMail
.To = ???? 'don't know what goes here
.CC = ""
.BCC = ""
.Subject = "Quote from TKM"
.Body = strbody
.Attachments.Add FilenameStr
.Display
End With
On Error GoTo 0

'Delete the pdf you send
Kill FilenameStr

Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "PDF add-in Not Installed"
End If
End Sub


Any help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Email one worksheet to email address on worksheet

Hi Veronica

..To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Veronica Johnson" wrote in message ...
Hi all,

I am using Excel 2007. I have a worksheet that I want to email via a
PDF file (I already downloaded the add-in) to the customer that is
listed in cell C5 of this worksheet. I took a look at Ron de Bruin's
site, but I don't know how to tailor the code specifically to email
the sheet to the customer listed on it.

Here is my code:

Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or
range.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim FilenameStr As String

If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE"
_
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <
"" Then

FilenameStr = Application.DefaultFilePath & "\" & _
Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False

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

strbody = "Hi there," & vbNewLine & vbNewLine & _
"Please see the attached PDF file for quote" & vbNewLine &
_
vbNewLine & "Thank you"

On Error Resume Next
With OutMail
.To = ???? 'don't know what goes here
.CC = ""
.BCC = ""
.Subject = "Quote from TKM"
.Body = strbody
.Attachments.Add FilenameStr
.Display
End With
On Error GoTo 0

'Delete the pdf you send
Kill FilenameStr

Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "PDF add-in Not Installed"
End If
End Sub


Any help would be appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default Email one worksheet to email address on worksheet

On Jan 25, 3:05*pm, "Ron de Bruin" wrote:
Hi Veronica

.To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Veronica Johnson" wrote in ...
Hi all,


I am using Excel 2007. *I have a worksheet that I want to email via a
PDF file (I already downloaded the add-in) to the customer that is
listed in cell C5 of this worksheet. *I took a look at Ron de Bruin's
site, but I don't know how to tailor the code specifically to email
the sheet to the customer listed on it.


Here is my code:


Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or
range.
* *Dim OutApp As Object
* *Dim OutMail As Object
* *Dim strbody As String
* *Dim FilenameStr As String


* *If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE"
_
* * * * & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <
"" Then


* * * *FilenameStr = Application.DefaultFilePath & "\" & _
* * * *Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"


* * * *ActiveSheet.ExportAsFixedFormat _
* * * * * * * *Type:=xlTypePDF, _
* * * * * * * *Filename:=FilenameStr, _
* * * * * * * *Quality:=xlQualityStandard, _
* * * * * * * *IncludeDocProperties:=True, _
* * * * * * * *IgnorePrintAreas:=False, _
* * * * * * * *OpenAfterPublish:=False


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


* * * *strbody = "Hi there," & vbNewLine & vbNewLine & _
* * * * * *"Please see the attached PDF file for quote" & vbNewLine &
_
* * * * * *vbNewLine & "Thank you"


* * * *On Error Resume Next
* * * *With OutMail
* * * * * *.To = ???? 'don't know what goes here
* * * * * *.CC = ""
* * * * * *.BCC = ""
* * * * * *.Subject = "Quote from TKM"
* * * * * *.Body = strbody
* * * * * *.Attachments.Add FilenameStr
* * * * * *.Display
* * * *End With
* * * *On Error GoTo 0


* * * *'Delete the pdf you send
* * * *Kill FilenameStr


* * * *Set OutMail = Nothing
* * * *Set OutApp = Nothing
* *Else
* * * *MsgBox "PDF add-in Not Installed"
* *End If
End Sub


Any help would be appreciated.- Hide quoted text -


- Show quoted text -


Thank you so much, Ron! BTW, your site has been very, very helpful!
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Email one worksheet to email address on worksheet

your site has been very, very helpful!
You are welcome

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Veronica Johnson" wrote in message ...
On Jan 25, 3:05 pm, "Ron de Bruin" wrote:
Hi Veronica

.To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Veronica Johnson" wrote in ...
Hi all,


I am using Excel 2007. I have a worksheet that I want to email via a
PDF file (I already downloaded the add-in) to the customer that is
listed in cell C5 of this worksheet. I took a look at Ron de Bruin's
site, but I don't know how to tailor the code specifically to email
the sheet to the customer listed on it.


Here is my code:


Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or
range.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim FilenameStr As String


If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE"
_
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <
"" Then


FilenameStr = Application.DefaultFilePath & "\" & _
Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"


ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False


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


strbody = "Hi there," & vbNewLine & vbNewLine & _
"Please see the attached PDF file for quote" & vbNewLine &
_
vbNewLine & "Thank you"


On Error Resume Next
With OutMail
.To = ???? 'don't know what goes here
.CC = ""
.BCC = ""
.Subject = "Quote from TKM"
.Body = strbody
.Attachments.Add FilenameStr
.Display
End With
On Error GoTo 0


'Delete the pdf you send
Kill FilenameStr


Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "PDF add-in Not Installed"
End If
End Sub


Any help would be appreciated.- Hide quoted text -


- Show quoted text -


Thank you so much, Ron! BTW, your site has been very, very helpful!

  #5   Report Post  
Junior Member
 
Posts: 6
Default

Ron, I have the same problem. I have added your code to my program and still cannot get it to work. I am using outlook 2003 and excel 2003. This is what I entered in my program
Sub Mail_Workbook_1()
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "Flagged Order"
.Body = "New Flagged Order!"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

I want this to be sent after it is saved.



Quote:
Originally Posted by Ron de Bruin View Post
your site has been very, very helpful!
You are welcome

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Veronica Johnson" wrote in message ...
On Jan 25, 3:05 pm, "Ron de Bruin" wrote:
Hi Veronica

.To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Veronica Johnson" wrote in ...
Hi all,


I am using Excel 2007. I have a worksheet that I want to email via a
PDF file (I already downloaded the add-in) to the customer that is
listed in cell C5 of this worksheet. I took a look at Ron de Bruin's
site, but I don't know how to tailor the code specifically to email
the sheet to the customer listed on it.


Here is my code:


Sub Mail_ActiveSheet_PDF_Outlook()
'Note: It is easy to change the code to send a workbook, selection or
range.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim FilenameStr As String


If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE"
_
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <
"" Then


FilenameStr = Application.DefaultFilePath & "\" & _
Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"


ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False


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


strbody = "Hi there," & vbNewLine & vbNewLine & _
"Please see the attached PDF file for quote" & vbNewLine &
_
vbNewLine & "Thank you"


On Error Resume Next
With OutMail
.To = ???? 'don't know what goes here
.CC = ""
.BCC = ""
.Subject = "Quote from TKM"
.Body = strbody
.Attachments.Add FilenameStr
.Display
End With
On Error GoTo 0


'Delete the pdf you send
Kill FilenameStr


Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "PDF add-in Not Installed"
End If
End Sub


Any help would be appreciated.- Hide quoted text -


- Show quoted text -


Thank you so much, Ron! BTW, your site has been very, very helpful!
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
send wkbk as an email attachment with an email address copied from SueInAtl Excel Discussion (Misc queries) 0 May 21st 07 10:53 PM
Email worksheet from a list of names and email Rookie_User Excel Discussion (Misc queries) 1 December 3rd 06 07:56 PM
can I copy a column of email addresses, paste into email address? Lizizfree New Users to Excel 4 July 20th 06 10:03 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM
worksheet email address to outlook xpress contact GMA Excel Worksheet Functions 1 July 24th 05 11:10 AM


All times are GMT +1. The time now is 06:38 PM.

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"