Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Excel worksheets bms Excel Discussion (Misc queries) 0 October 23rd 07 08:36 PM
Saving worksheets using a Macro lqfong Excel Discussion (Misc queries) 1 June 27th 06 01:10 PM
Saving worksheets Tkaminski Excel Worksheet Functions 1 April 18th 05 03:49 PM
Saving Worksheets D.Parker Excel Programming 2 March 29th 05 05:25 AM
Saving worksheets without Auto_Open Bowbender Excel Programming 4 May 18th 04 06:47 PM


All times are GMT +1. The time now is 11:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"