Results 1 to 4 of 4

Thread: How to email a single Excel worksheet in place of entire spreadsheet

  1. #1
    Join Date
    Nov 2011
    Posts
    41

    How to email a single Excel worksheet in place of entire spreadsheet

    I have an Excel workbook with several worksheets. I want to email just one of these worksheets to a friend. It would be great to right-click the worksheet tab and find the option to send worksheet as an attachment. Can anyone please help. Thanks

  2. #2
    Join Date
    Mar 2011
    Posts
    542

    Re: How to email a single Excel worksheet in place of entire spreadsheet

    An easy way is to select and copy the worksheet you want to email, then create a new workbook (excel file) and paste the worksheet in. I have done it in the past and it works just fine.

  3. #3
    Join Date
    May 2011
    Posts
    523

    Re: How to email a single Excel worksheet in place of entire spreadsheet

    This is the most common issue and there is a fix for that. It is possible to mail a single excel worksheet instead of entire worksheet. A much faster method is right clicking on the worksheet and click on copy to another spread sheet and mailing. Remember that if this sheet has cell references from others then you might get error. You can also copy paste the entire content and move it to single sheet and mail it. I am not sure there is a direct method in excel which provides this support.

  4. #4
    Join Date
    May 2011
    Posts
    410

    Re: How to email a single Excel worksheet in place of entire spreadsheet

    Use the following VB code. This can help you to send single sheet in mail:
    Code:
    Sub Mail_ActiveSheet()
    ' Works in Excel 97 through Excel 2007.
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    
    With Application
       .ScreenUpdating = False
       .EnableEvents = False
    End With
    
    Set Sourcewb = ActiveWorkbook
    ' Using ActiveSheet.Copy creates a new workbook with 
    ' the sheet and the file format is the same as the 
    ' original workbook. 
    ' Copy the worksheet to a new workbook.
    ActiveSheet.Copy
    Set Destwb = ActiveWorkbook
    
    ' Determine the Excel version and file extension/format.
    With Destwb
       If Val(Application.Version) < 12 Then
          ' You are using Excel 97-2003.
          FileExtStr = ".xls": FileFormatNum = -4143
       Else
          ' You are using Excel 2007.
          ' When you use ActiveSheet.Copy to create a workbook,
          ' you are prompted with a security dialog. If you click No
          ' in the dialog, then the name of Sourcewb is the same
          ' as Destwb and you exit the subroutine. You only see this
          ' dialog when you attempt to copy a worksheet from an .xlsm file with macros disabled.
          If Sourcewb.Name = .Name Then
             With Application
                .ScreenUpdating = True
                .EnableEvents = True
             End With
             MsgBox "Your answer is No in the security dialog."
             Exit Sub
          Else
             Select Case Sourcewb.FileFormat
                ' Code 51 represents the enumeration for a macro-free
                ' Excel 2007 Workbook (.xlsx).
                Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
                ' Code 52 represents the enumeration for a 
                ' macro-enabled Excel 2007 Workbook (.xlsm).
                Case 52:
                   If .HasVBProject Then
                      FileExtStr = ".xlsm": FileFormatNum = 52
                   Else
                      FileExtStr = ".xlsx": FileFormatNum = 51
                   End If
                ' Code 56 represents the enumeration for a 
                ' a legacy Excel 97-2003 Workbook (.xls).
                Case 56: FileExtStr = ".xls": FileFormatNum = 56
                ' Code 50 represents the enumeration for a 
                ' binary Excel 2007 Workbook (.xlsb).
                 Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
             End Select
          End If
       End If
    End With
    
    ' Change all cells in the worksheet to values, if desired.
    ''   With Destwb.Sheets(1).UsedRange
    ''      .Cells.Copy
    ''      .Cells.PasteSpecial xlPasteValues
    ''      .Cells(1).Select
    ''   End With
    ''Application.CutCopyMode = False
    
    'Save the new workbook and then mail it.
       TempFilePath = Environ$("temp") & "\"
       TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")
    
    With Destwb
       .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
          On Error Resume Next
          For I = 1 To 3
             .SendMail "someone@somewhere.com", _
                "This is the Subject line"
                If Err.Number = 0 Then Exit For
          Next I
          On Error GoTo 0
       .Close SaveChanges:=False
    End With
     
    ' Delete the file you just sent.
    Kill TempFilePath & TempFileName & FileExtStr
    
    With Application
       .ScreenUpdating = True
       .EnableEvents = True
    End With
    End Sub
    And for more references please see the below site :

    Working with Excel Workbooks and Worksheets in E-Mail

Similar Threads

  1. Replies: 6
    Last Post: 24-02-2012, 01:50 PM
  2. Can I print more than one Excel worksheet on a single page
    By Anchal in forum MS Office Support
    Replies: 2
    Last Post: 27-01-2012, 07:09 PM
  3. Replies: 8
    Last Post: 04-12-2011, 11:24 AM
  4. Filter row in a single worksheet
    By Karunashankar in forum Windows Software
    Replies: 10
    Last Post: 28-07-2011, 12:13 PM
  5. How to consolidate data in a single worksheet?
    By bell yard in forum Windows Software
    Replies: 3
    Last Post: 04-11-2010, 06:02 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,254,860.64231 seconds with 17 queries