Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy and email

Hi
This code copies sheet1 and emails it. How can I mail values only without
links?

strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Myfile" & Range("B56") & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail

For Each Cell In ThisWorkbook.Sheets("Distribution List") _
.Columns("B").Cells.SpecialCells(xlCellTypeConstan ts)
If Cell.Value Like "*@*" Then
strto = strto & Cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

.To = strto
.CC = ""
.BCC = ""
.Subject = "Loadfcst" & Range("B56") & ".xls"
.Body = ""
.Attachments.Add wb.FullName
.Send
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False

Application.ScreenUpdating = True
End With

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copy and email

Hi Saeed

See
http://www.rondebruin.nl/mail/tips2.htm

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


"Saeed" wrote in message ...
Hi
This code copies sheet1 and emails it. How can I mail values only without
links?

strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Myfile" & Range("B56") & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail

For Each Cell In ThisWorkbook.Sheets("Distribution List") _
.Columns("B").Cells.SpecialCells(xlCellTypeConstan ts)
If Cell.Value Like "*@*" Then
strto = strto & Cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

.To = strto
.CC = ""
.BCC = ""
.Subject = "Loadfcst" & Range("B56") & ".xls"
.Body = ""
.Attachments.Add wb.FullName
.Send
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False

Application.ScreenUpdating = True
End With

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
bac bac is offline
external usenet poster
 
Posts: 76
Default Copy and email

Is there any reason you can't do a Copy-Paste Special-Values before setting
ScreenUpdating = False?



"Saeed" wrote:

Hi
This code copies sheet1 and emails it. How can I mail values only without
links?

strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Myfile" & Range("B56") & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail

For Each Cell In ThisWorkbook.Sheets("Distribution List") _
.Columns("B").Cells.SpecialCells(xlCellTypeConstan ts)
If Cell.Value Like "*@*" Then
strto = strto & Cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

.To = strto
.CC = ""
.BCC = ""
.Subject = "Loadfcst" & Range("B56") & ".xls"
.Body = ""
.Attachments.Add wb.FullName
.Send
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False

Application.ScreenUpdating = True
End With

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy and email

Thank you!

"Ron de Bruin" wrote:

Hi Saeed

See
http://www.rondebruin.nl/mail/tips2.htm

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


"Saeed" wrote in message ...
Hi
This code copies sheet1 and emails it. How can I mail values only without
links?

strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Myfile" & Range("B56") & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail

For Each Cell In ThisWorkbook.Sheets("Distribution List") _
.Columns("B").Cells.SpecialCells(xlCellTypeConstan ts)
If Cell.Value Like "*@*" Then
strto = strto & Cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

.To = strto
.CC = ""
.BCC = ""
.Subject = "Loadfcst" & Range("B56") & ".xls"
.Body = ""
.Attachments.Add wb.FullName
.Send
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False

Application.ScreenUpdating = True
End With

Thanks!




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
How do I email an inactive copy of a worksheet Jackaroo 1281 Excel Discussion (Misc queries) 1 January 1st 09 03:36 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
Need a macro to Copy a selection and paste into a new email. Koolmist Excel Discussion (Misc queries) 3 February 20th 06 04:48 PM
Macro - Copy - Email John Excel Worksheet Functions 1 March 2nd 05 07:36 PM
Copy/Paste to email Beeel Excel Programming 1 January 18th 05 01:53 PM


All times are GMT +1. The time now is 03:21 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"