Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Saving macro generated reports
Saving macro generated reports
Resolved · Low Priority · Version 2003
Saving macro generated reports
Can you show me the code for saving the report in a new file / folder rather than in the data worksheet. ThanksFor upcoming training course dates see: Pricing & availability
RE: Saving macro generated reports
Hi Simon, thanks for the query. Here's the code you need. Make sure the mynewfilename variable is set your desktop (it's set to mine in the example below). The code copies strName to a new file, then saves that file to the desktop.***
Dim mynewfilename As String
mynewfilename = "C:\Documents and Settings\User10\Desktop\" & strName & ".xls"
Sheets(strName).Select
Sheets(strName).Copy
ActiveWorkbook.SaveAs Filename:=mynewfilename
ActiveWorkbook.Close
***
Hope this is useful!
Anthony
Sun 31 Jan 2010: Automatically marked as resolved.
|



Course updates

