VBA code for create a copy of one excel file

Rajdavid Posts 1 Registration date Friday July 6, 2018 Status Member Last seen July 6, 2018 - Updated on Jul 6, 2018 at 04:38 PM
 Blocked Profile - Jul 6, 2018 at 12:59 PM
I want a VBA code for create a copy of one excel file that contains all the contents without macros and also I want to send that workbook though mail to a some default email ids....the copy workbook name should be a one cell value in my original workbook ...kindly solve my issue any one please...

1 response

No thanks, I will pass! If you were stuck with something, I would pitch in, but I don't do demands for free services! Record a macro of what you want done! It is that simple. As for the email, no email server will accept an excel file without first compressing it (zip). Why don't you use powershell to send the mail (after you have zipped it up!). It is as simple as :

Send-MailMessage -To "Someuser@emailserver.com" -From "me@emailexample.com" -Subject "Zipped Excel" -Attachments "C:\NEW\thefilenameishere.xlsx"

I got bored waiting for updates, so I recorded a macro:

ChDir "C:\NEW"
ActiveWorkbook.SaveAs Filename:="C:\NEW\thefilenameishere.xlsx", FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False