How do I save a single worksheet to a different file using VBA 03
I am converting an old Excel 4 macro to VBA and I want to save single
worksheet to a new .xls file. The old command was =SAVE.AS(path&CELL("contents",Invoice!$H$2),1,"",F ALSE,"",TRUE). I am using Excel 2003 and VBA v6.5. |
How do I save a single worksheet to a different file using VBA 03
Here's a start...
Sub Macro1() fName = Sheets("Invoice").Range("$H$2").Value Set NewBook = Workbooks.Add NewBook.SaveAs Filename:=fName End Sub "Alpineskier" wrote: I am converting an old Excel 4 macro to VBA and I want to save single worksheet to a new .xls file. The old command was =SAVE.AS(path&CELL("contents",Invoice!$H$2),1,"",F ALSE,"",TRUE). I am using Excel 2003 and VBA v6.5. |
How do I save a single worksheet to a different file using VBA
the new workbook in JMay code will create an empty workbook. the code below
will save the current workbook to a new filename. Sub Macro1() Folder = activeworkbook.path fName = Sheets("Invoice").Range("$H$2").Value Thisworkbook.SaveAs Filename:=Folder & "\" & fName End Sub "Alpineskier" wrote: I am converting an old Excel 4 macro to VBA and I want to save single worksheet to a new .xls file. The old command was =SAVE.AS(path&CELL("contents",Invoice!$H$2),1,"",F ALSE,"",TRUE). I am using Excel 2003 and VBA v6.5. "JMay" wrote: Here's a start... Sub Macro1() fName = Sheets("Invoice").Range("$H$2").Value Set NewBook = Workbooks.Add NewBook.SaveAs Filename:=fName End Sub "Alpineskier" wrote: I am converting an old Excel 4 macro to VBA and I want to save single worksheet to a new .xls file. The old command was =SAVE.AS(path&CELL("contents",Invoice!$H$2),1,"",F ALSE,"",TRUE). I am using Excel 2003 and VBA v6.5. |
All times are GMT +1. The time now is 05:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com