I have a workbook with 5 sheets and VBA Code attached. The sheets are updated each business day and carry a rolling 6 months of history. I want to peel off 2 of these sheets and place them into a new workbook, with a date stamp in the filename, with zero VBA Code; this new workbook will be attached to a daily e-mail.
My code has been peeling off 1 sheet, WITH ZERO CODE, into a new workbook and e-mailing such workbook for several months. However, 2 sheets inserted into a new workbook is more difficult, at least for me.
A related query: in my existing code, after bringing in new data to the 6-month history workbook, I was playing around with 1) saving the parent workbook; 2) deleting 3 of the sheets; 3) saving the active wb (of course, this includes VBA Code); 4) activating the parent wb; and 5) e-mailing the
2-sheet wb.
Two problems: a) the e-mailed wb would include VBA Code (not desirable); and b) the e-mail fails because the error message indicates that the file to be attached is in use by another process. When stepping thru the Code, when the above step 4) is processed, nothing appears to happen. (I thought that when a File SaveAs occurs, that the original file was still hanging around in the "background" -- but I'm not sure that is the case. Also, I guess if two workbooks share the same VBA Code, it is problematic to attach one of them to an e-mail.)
Strategic suggestions would be appreciated,
Chuckles123
Bookmarks