Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Worksheets
I have a vba application I'm working on that creates numerous worksheets
within a workbook. I need to save off a copy of specific worksheets from the workbook to their own file name. The object model appears to support that by using the saveas method with a worksheet object rather than the workbook object. When I try to actually do that in code, though, it saves the entire workbook. My work around is to save it then delete all of the worksheets I don't want, but that seems to be an around the elbow way to get the job done. Is there a way to save a worksheet out of a workbook? Thanks, Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Worksheets
Try this:
Sub test() Sheets("YourSheetName").Select Sheets("YourSheetName").Copy ActiveWorkbook.SaveAs Filename:= _ "Yourpath" & "YourSheetName", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub Regards, Stefi €˛Mike€¯ ezt Ć*rta: I have a vba application I'm working on that creates numerous worksheets within a workbook. I need to save off a copy of specific worksheets from the workbook to their own file name. The object model appears to support that by using the saveas method with a worksheet object rather than the workbook object. When I try to actually do that in code, though, it saves the entire workbook. My work around is to save it then delete all of the worksheets I don't want, but that seems to be an around the elbow way to get the job done. Is there a way to save a worksheet out of a workbook? Thanks, Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Worksheets
Thanks Stefi...that worked very well!
"Stefi" wrote: Try this: Sub test() Sheets("YourSheetName").Select Sheets("YourSheetName").Copy ActiveWorkbook.SaveAs Filename:= _ "Yourpath" & "YourSheetName", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub Regards, Stefi €˛Mike€¯ ezt Ć*rta: I have a vba application I'm working on that creates numerous worksheets within a workbook. I need to save off a copy of specific worksheets from the workbook to their own file name. The object model appears to support that by using the saveas method with a worksheet object rather than the workbook object. When I try to actually do that in code, though, it saves the entire workbook. My work around is to save it then delete all of the worksheets I don't want, but that seems to be an around the elbow way to get the job done. Is there a way to save a worksheet out of a workbook? Thanks, Mike |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Worksheets
You are welcome! Thanks for the feedback!
Stefi €˛Mike€¯ ezt Ć*rta: Thanks Stefi...that worked very well! "Stefi" wrote: Try this: Sub test() Sheets("YourSheetName").Select Sheets("YourSheetName").Copy ActiveWorkbook.SaveAs Filename:= _ "Yourpath" & "YourSheetName", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub Regards, Stefi €˛Mike€¯ ezt Ć*rta: I have a vba application I'm working on that creates numerous worksheets within a workbook. I need to save off a copy of specific worksheets from the workbook to their own file name. The object model appears to support that by using the saveas method with a worksheet object rather than the workbook object. When I try to actually do that in code, though, it saves the entire workbook. My work around is to save it then delete all of the worksheets I don't want, but that seems to be an around the elbow way to get the job done. Is there a way to save a worksheet out of a workbook? Thanks, Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving Excel worksheets | Excel Discussion (Misc queries) | |||
Saving worksheets using a Macro | Excel Discussion (Misc queries) | |||
Saving worksheets | Excel Worksheet Functions | |||
Saving Worksheets | Excel Programming | |||
Saving worksheets without Auto_Open | Excel Programming |