auto email...no links

Davers

Well-known Member
Joined
Sep 17, 2002
Messages
1,165
I have some code that takes the active sheet and sends it as an attachment in Outlook. There are quite a few formulae in the worksheet, so I copy the range and paste values...However, that attachment still has the links to the original Workbook. Is there any way I can sever the links before it gets mailed out??? Here is the code below...


Sub Mail_ActiveSheet()
Dim strDate As String
' This sends the active sheet in the book
ActiveSheet.Copy
strDate = Format(Date, "mm-dd-yy")
' This names the sheet
ActiveWorkbook.SaveAs "One Sheet of " & ThisWorkbook.Name _
& " " & strDate & ".xls"

Range("B1:X79").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B1").Select
' This is your mail recipient, then the subject line
ActiveWorkbook.SendMail "me@work.com", _
"BAC Totals Report for "
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End Sub

Thanks,

Dave M.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Manually copy the sheet to a new workbook and do the Copy|Paste Special Values bit. Then choose Insert|Name|Define and examine the Names for any that refer to your original workbook. You will need to delete these in your code to sever the links before mailing the workbook.

Or you can copy the cells instead of the sheet, like this:

Code:
Sub Test()
    ActiveSheet.Cells.Copy
    Workbooks.Add
    ActiveSheet.Paste
    ActiveSheet.Cells.Copy
    ActiveCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
End Sub
[/code]
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,322
Members
451,696
Latest member
Senthil Murugan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top