+ Reply to Thread
Results 1 to 4 of 4

Saving subset of Worksheets

Hybrid View

  1. #1
    Registered User
    Join Date
    10-02-2008
    Location
    Canada
    Posts
    8

    Saving subset of Worksheets

    Hi all,
    I am trying to e-mail a portion of a spreadsheet that I have. My approach is the following: I save a copy in a temporary folder, open that copy, remove all the sheets that I don't need to send out, save it (same name as the e-mail subject), and then e-mail as an attachment. The current approach does not remove the macros and references though. I use the following to remove the macros and references:

    Set vbCom = Application.VBE.VBProjects(EmailSubject).VBComponents
    vbCom.Remove VBComponent:=vbCom.Item("AddIn_Manager")
        
    Set vbRef = Application.VBE.VBProjects(EmailSubject).References
    vbRef.Remove Reference:=vbRef.Item(1)
    Any thoughts on this? or perhaps suggestions for another method?
    Last edited by rtiltins; 11-04-2008 at 03:16 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Why not just copy the sheets you need to a new workbook?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-02-2008
    Location
    Canada
    Posts
    8
    This way (saving copy of workbook) seemed easier because there are very many pages to copy, with a lot of images/charts that needed to be copied as well. Sometimes there are more than 20 worksheets for which all cells, all charts and images/logos would also need to be copied. Using the savecopyas approach I just needed to remove three worksheets that I don't want to be sending out.

    Finally found a pretty helpful link related to this, and was able to get the desired result using code from there. Here is the link that I used:

    http://www.cpearson.com/excel/vbe.aspx

    Thanks for the comments.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    That's the definitive reference.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1