Hi, I found the following code from the net to email a range of cells in a
worksheet. It worked with one problem. It would not retain the original
column width.
In the Add_range sub, I tried to change
wsTarget.Range("A1").PasteSpecial (xlPasteAll)
to
wsTarge.Range("A1").PasteSpecial (xlPasteColumnWidth)
but Excel won't take it.
How can I fix this problem?
Thank you.
GL
*********************************************
Private Sub CommandButton1_Click()
If Application.MailSystem <> xlNoMailSystem Then
With ActiveWorkbook
Add_range
..SendMail Recipients:="[email protected]"
..Close SaveChanges:=False
End With
Application.MailLogoff
Else
MsgBox "No MS-postsystem are installed.", vbInformation, _
"E-mail message"
End If
End Sub
**********************************************
Sub Add_range()
Dim wbOriginal As Workbook
Dim wsOriginal As Worksheet
Dim wsTarget As Worksheet
Dim rnSource As Range
Set wbOriginal = ThisWorkbook
Set wsOriginal = wbOriginal.Worksheets("ThisOne")
With wsOriginal
Set rnSource = .Range("A1:D10")
End With
Application.ScreenUpdating = False
Workbooks.Add (xlWBATWorksheet)
Set wsTarget = ActiveSheet
rnSource.Copy
wsTarget.Range("A1").PasteSpecial (xlPasteAll)
With Application
..CutCopyMode = False
..ScreenUpdating = True
End With
End Sub
******************************************
Bookmarks