View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] dhgerstman@gmail.com is offline
external usenet poster
 
Posts: 6
Default Saving a worksheet to a new workbook

I am trying to copy a worksheet to a new workbook and then close the
current workbook, so I can work in the worksheet.
This is what I've written.
Worksheets("Source_Worksheet").Activate
ActiveSheet.Copy
ActiveSheet.Paste
ActiveSheet.SaveAs "c:\My Excel Files\" & wsname & ".xls"
Workbooks("Source_Workbook.xls").Close

When I try the SaveAs, I get a run-time 1004 error for a bad path or
file name. (wsname is a string data type.)

David