<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx</link><description>Today’s author is Ron de Bruin , an Excel MVP. You can find more useful tips and links to Excel add-ins at his website: http://www.rondebruin.nl/ You see a lot of old SaveAs code that does not specify the FileFormat parameter. In Excel versions before</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9824157</link><pubDate>Wed, 08 Jul 2009 18:29:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9824157</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;This works great! Thanks! &lt;/p&gt;
&lt;p&gt;Except the worksheet that I am copying &amp;amp; saving has form controls on it, but I don't want them to be copied. How do I change the code to accommodate this?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Andy&lt;/p&gt;
&lt;p&gt;andyngretch@Msn.com&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9824207</link><pubDate>Wed, 08 Jul 2009 18:48:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9824207</guid><dc:creator>Ron de Bruin</dc:creator><description>&lt;p&gt;Hi Andy&lt;/p&gt;
&lt;p&gt;See this page for code that you can add to the macro. If you need more help let me know.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.rondebruin.nl/controlsobjectsworksheet.htm"&gt;http://www.rondebruin.nl/controlsobjectsworksheet.htm&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9828995</link><pubDate>Fri, 10 Jul 2009 22:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9828995</guid><dc:creator>Harlan Grove</dc:creator><description>&lt;p&gt;Seems moderation kicked out my previous comments. I'll try again without code.&lt;/p&gt;
&lt;p&gt;Your macro is gross overkill and could be tightened up considerably. However, there's a better way to handle the FileFormat parameter of the .SaveAs method call: use a private function. Pass that function a reference to the original workbook, and encapsulate the code to handle Excel 12+ file formats there rather than in the body of your macro.&lt;/p&gt;
&lt;p&gt;Encapsulating picky details, especially those details necessary for handling differences between versions, is usually considered programming best practice. Dumping such details in ad hoc macros isn't programming best practice.&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9829018</link><pubDate>Fri, 10 Jul 2009 22:32:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9829018</guid><dc:creator>Ron de Bruin</dc:creator><description>&lt;p&gt;Hi Harlan&lt;/p&gt;
&lt;p&gt;I am sure there are better ways and please post them.&lt;/p&gt;
&lt;p&gt;The problem with seperate functions is that readers from my site always forget to copy them in the module together with the macro.&lt;/p&gt;
&lt;p&gt;So I like to add it to the macro so it is a copy/Paste for a user.&lt;/p&gt;
&lt;p&gt;You will not now how many private many mails I get from people that forgot to copy the functions that i use on a few of my pages.&lt;/p&gt;
&lt;p&gt;And remember Harlan I am a flower grower and no programmer.&lt;/p&gt;
&lt;p&gt;Thanks for your reply&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9829708</link><pubDate>Sat, 11 Jul 2009 22:36:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9829708</guid><dc:creator>Weldon Dodd</dc:creator><description>&lt;p&gt;The new file doesn't have any of the macro modules from the original workbook. Is there a way to pass modules to the new workbook? Ideally, I'd like to pass one module and not all of them.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9829711</link><pubDate>Sat, 11 Jul 2009 22:43:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9829711</guid><dc:creator>Weldon Dodd</dc:creator><description>&lt;p&gt;on re-reading I realized that my question is almost the opposite of Andy's. I am using a second worksheet (order history) to prepopulate the first worksheet (order sheet). I want the macros and buttons associated with the order sheet to continue to work in the new workbook that I save for each customer. I do not want the additional worksheets and the file generation macros from the original worksheet (which are all in a separate module from the user controls)&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9829726</link><pubDate>Sat, 11 Jul 2009 23:31:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9829726</guid><dc:creator>Ron de Bruin</dc:creator><description>&lt;p&gt;Hi Weldon&lt;/p&gt;
&lt;p&gt;Use a button of the control toolbox and add your code in the click event of this button.&lt;/p&gt;
&lt;p&gt;This event is in the sheet module so your button will work&lt;/p&gt;
&lt;p&gt;If you want to mail each sheet see also&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.rondebruin.nl/sendmail.htm"&gt;http://www.rondebruin.nl/sendmail.htm&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9835666</link><pubDate>Thu, 16 Jul 2009 17:14:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835666</guid><dc:creator>Rick Henderson</dc:creator><description>&lt;p&gt;Interesting post Ron. Finally! I've found a VBA blog associated with Microsoft!&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9842274</link><pubDate>Mon, 20 Jul 2009 23:44:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9842274</guid><dc:creator>Jayson</dc:creator><description>&lt;p&gt;One thing I've learned (the hard way of course) is that there are different FileFormatNum for an .xls created in xl2003 and xl2007. &amp;nbsp;If you are running xl2003 you should use -4143. &amp;nbsp;If you are running xl2007 then use 56.&lt;/p&gt;
&lt;p&gt;I've used this bit of code before to take care of this.&lt;/p&gt;
&lt;p&gt;If Val(Application.Version) &amp;lt; 12 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;'You use Excel 97-2003&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;FileExtStr = &amp;quot;.xls&amp;quot;: FileFormatNum = -4143&lt;/p&gt;
&lt;p&gt;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;'you use excel 2007 or later&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;FileExtStr = &amp;quot;.xls&amp;quot;: FileFormatNum = 56&lt;/p&gt;
&lt;p&gt;End If&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9845822</link><pubDate>Thu, 23 Jul 2009 09:19:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9845822</guid><dc:creator>Gary B</dc:creator><description>&lt;p&gt;I liked your article, however, if the sheet that is being copied to a new file contains a chart, then &amp;quot;sometimes&amp;quot; the chart does not appear correctly (as if it has lost its data series) in the new file.&lt;/p&gt;
&lt;p&gt;I have found it useful to save the file, with a new name (and a different fileformat), deleting any sheets taht are not required in the final workbook, and removing all vba as the original file has an &amp;quot;On Open&amp;quot; routine that is run, which i don't want run from the final file.&lt;/p&gt;
&lt;p&gt;In other words, sometimes it is better to NOT copy a sheet to a new file, but rather copy the file and make changes to the new file. &amp;nbsp;Sometimes :-)&lt;/p&gt;
</description></item><item><title>re: Use the VBA SaveAs Method in Excel 2007</title><link>http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx#9846428</link><pubDate>Thu, 23 Jul 2009 17:58:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9846428</guid><dc:creator>Ron de Bruin</dc:creator><description>&lt;p&gt;Hi Gary&lt;/p&gt;
&lt;p&gt;Thanks for you reply&lt;/p&gt;
&lt;p&gt;I have this option also in my mail add-ins&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.rondebruin.nl/mail/add-in.htm"&gt;http://www.rondebruin.nl/mail/add-in.htm&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>