Reputation: 2058
I recieved an excel workbook with data and I added a macro to it with a button that activates the macro. I have to return the excel workbook with the macro by email. I added the workbook to the email as an attachment. I wanted to check the attached file to see if everything is ok and I saw that the macro isn't there.
The excel file is macro enabled.
How should this be done? Thank you.
Upvotes: 4
Views: 20699
Reputation: 692
Save it as .XLSM before sending, it is working with small test. you can specify the workbook name also if more than one workbook is open.
Sub marco()
With ActiveWorkbook.Sheets(1)
Range("a21").Select
ActiveCell.Formula = "=sum(a2:a20)"
End With
ActiveWorkbook.SaveAs _
"C:\Documents and Settings\Desktop\file.xlsm", FileFormat:=52
ActiveWorkbook.SendMail Recipients:="[email protected]"
End Sub
Upvotes: 1