Michael Fowler
New Member
- Joined
- Jan 23, 2024
- Messages
- 28
- Office Version
- 2021
- 2016
- Platform
- Windows
I'm successfully using an Excel file with VBA code to send a copy of the Active Sheet as an attachment in an email, and this works very well. But now I have a similar situation except that now I need to send the whole file rather than just one sheet. I've changed this part of the code ...
Set Wb = Application.ActiveWorkbook
ActiveSheet.Copy
Set Wb2 = Application.ActiveWorkbook
to this ...
Set Wb = Application.ActiveWorkbook
ActiveWorkbook.Copy
Set Wb2 = Application.ActiveWorkbook
... and as a result of doing this, the original source Excel file closes after running the macro, whereas it doesn't when I'm only sending one sheet. Please advise what coding I need to insert or modify to keep the original Excel source file remaining open.
Thanks, Michael
Set Wb = Application.ActiveWorkbook
ActiveSheet.Copy
Set Wb2 = Application.ActiveWorkbook
to this ...
Set Wb = Application.ActiveWorkbook
ActiveWorkbook.Copy
Set Wb2 = Application.ActiveWorkbook
... and as a result of doing this, the original source Excel file closes after running the macro, whereas it doesn't when I'm only sending one sheet. Please advise what coding I need to insert or modify to keep the original Excel source file remaining open.
Thanks, Michael