ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving a single Worksheet w/o redundant prompts (https://www.excelbanter.com/excel-programming/345309-saving-single-worksheet-w-o-redundant-prompts.html)

Jeff Harbin[_4_]

Saving a single Worksheet w/o redundant prompts
 
I am trying to save 1 worksheet out of a workbook that contains 5 worksheets.
I've tried several methods but am not able to make something that I'm
completely happy with.

I'm working in Excel 2003 (and 2000) and I've included the meat of my
current thought process below. The problem I'm having is that when the
application goes to close the activewindow (which is a new workbook that I've
copied the target worksheet into) I get a prompt asking me if I want to save
the changes to the new workbook. Regardless of whethere I click yes or no
the new workbook is where it's supposed to be so I know the code is working
up to the Save command. I don't know why I'm being prompted to save it
again. This code will reside on someone elses machine and I don't want the
redundant Save dialogue box to appear.

Here's the code:

Sheets("WB3 Data").Select
Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ThisWorkbook.Saved = True
ActiveWindow.Close


Thanks...


Rowan Drummond[_3_]

Saving a single Worksheet w/o redundant prompts
 
Try:

Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close False

Hope this helps
Rowan

Jeff Harbin wrote:
I am trying to save 1 worksheet out of a workbook that contains 5 worksheets.
I've tried several methods but am not able to make something that I'm
completely happy with.

I'm working in Excel 2003 (and 2000) and I've included the meat of my
current thought process below. The problem I'm having is that when the
application goes to close the activewindow (which is a new workbook that I've
copied the target worksheet into) I get a prompt asking me if I want to save
the changes to the new workbook. Regardless of whethere I click yes or no
the new workbook is where it's supposed to be so I know the code is working
up to the Save command. I don't know why I'm being prompted to save it
again. This code will reside on someone elses machine and I don't want the
redundant Save dialogue box to appear.

Here's the code:

Sheets("WB3 Data").Select
Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ThisWorkbook.Saved = True
ActiveWindow.Close


Thanks...


Jeff Harbin[_4_]

Saving a single Worksheet w/o redundant prompts
 
Thanks. That seems to have done the job.



"Rowan Drummond" wrote:

Try:

Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close False

Hope this helps
Rowan

Jeff Harbin wrote:
I am trying to save 1 worksheet out of a workbook that contains 5 worksheets.
I've tried several methods but am not able to make something that I'm
completely happy with.

I'm working in Excel 2003 (and 2000) and I've included the meat of my
current thought process below. The problem I'm having is that when the
application goes to close the activewindow (which is a new workbook that I've
copied the target worksheet into) I get a prompt asking me if I want to save
the changes to the new workbook. Regardless of whethere I click yes or no
the new workbook is where it's supposed to be so I know the code is working
up to the Save command. I don't know why I'm being prompted to save it
again. This code will reside on someone elses machine and I don't want the
redundant Save dialogue box to appear.

Here's the code:

Sheets("WB3 Data").Select
Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ThisWorkbook.Saved = True
ActiveWindow.Close


Thanks...



Rowan Drummond[_3_]

Saving a single Worksheet w/o redundant prompts
 
You're welcome.

Jeff Harbin wrote:
Thanks. That seems to have done the job.



"Rowan Drummond" wrote:


Try:

Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close False

Hope this helps
Rowan

Jeff Harbin wrote:

I am trying to save 1 worksheet out of a workbook that contains 5 worksheets.
I've tried several methods but am not able to make something that I'm
completely happy with.

I'm working in Excel 2003 (and 2000) and I've included the meat of my
current thought process below. The problem I'm having is that when the
application goes to close the activewindow (which is a new workbook that I've
copied the target worksheet into) I get a prompt asking me if I want to save
the changes to the new workbook. Regardless of whethere I click yes or no
the new workbook is where it's supposed to be so I know the code is working
up to the Save command. I don't know why I'm being prompted to save it
again. This code will reside on someone elses machine and I don't want the
redundant Save dialogue box to appear.

Here's the code:

Sheets("WB3 Data").Select
Sheets("WB3 Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\testsave.csv", FileFormat:=xlCSV, CreateBackup:=False
ThisWorkbook.Saved = True
ActiveWindow.Close


Thanks...




All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com