Does ino in deleted sheets persist?

  • Thread starter Thread starter (Pete Cresswell)
  • Start date Start date
P

(Pete Cresswell)

I just delivered an MS Access application that creates .XLS files - each
containing four sheets of employee/budget information. Two of the sheets
contain only hourly data and two contain dollar amounts - from which one could
deduce the hourly rate of an employee.

Now the client has decided that they want the dollar sheets in separate .XLS
files.

My first thought is not to touch the process of creating a 4-sheet .XLS and just
tack come code on to the end that saves the 4-sheet file twice - once named as
an "Hours" document and once named as a "Dollars" document. Then I'd open up
both, delete the two unwanted sheets in each, and save them.

The question: does any data from the deleted sheets persist in the .XLS file -
like it does in MS Word for the change history?
 
Pete,

If you do a Worksheets.Copy, it creates a new workbook

Worksheets("Dollar Amount").Copy
ActiveWorkbook.SaveAs Filename:= "some name.xls"

should do what you want

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Per Bob Phillips:
If you do a Worksheets.Copy, it creates a new workbook

Worksheets("Dollar Amount").Copy
ActiveWorkbook.SaveAs Filename:= "some name.xls"

should do what you want

Thanks. Sounds like the ticket - create the new .XLS with the non-sensitive
data...

Not to turn into a tarbaby on you....but I need to copy two sheets instead of
one - can that be done with a variation on that syntax.
 
Per (Pete Cresswell):
can that be done with a variation on that syntax.

The closest I can come right now is:
---------------------------------------------
Const myName = "Whoopie.XLS"

Worksheets("mySheet1").Copy
ActiveWorkbook.SaveAs Filename:=myName
Windows("Book1").Activate
Worksheets("mySheet2").Copy Destination:=Windows(myName)
 
Pete,

Try this

Worksheets("mySheet1").Copy
ActiveWorkbook.SaveAs Filename:=myName
Worksheets("mySheet2").Copy After:=Workbooks(myName).Worksheets(1)


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Per Bob Phillips:
Try this

Worksheets("mySheet1").Copy
ActiveWorkbook.SaveAs Filename:=myName
Worksheets("mySheet2").Copy After:=Workbooks(myName).Worksheets(1)

Bingo!
--------------------------------------------------------------------
3625 myHoursOnlyPath = outputFileNameCreate(outputDir,
prvDepartmentCode, thePeriodDate1, thePayPeriodNumber, myHoursSuffix,
myHoursOnlyName)
3626 myDollarsHoursPath = outputFileNameCreate(outputDir,
prvDepartmentCode, thePeriodDate1, thePayPeriodNumber, myDollarsSuffix,
myDollarsHoursName)

3630 .Workbooks(1).SaveAs myDollarsHoursPath

3632
..Workbooks(myDollarsHoursName).Worksheets(mSheetName_Hours_Period).Copy
'Creates a brand new workbook, which becomes the .ActiveWorkbook
3633 .ActiveWorkbook.SaveAs FileName:=myHoursOnlyPath

3634
..Workbooks(myDollarsHoursName).Worksheets(mSheetName_Hours_YTD).Copy
After:=.Workbooks(myHoursOnlyName).Worksheets(mSheetName_Hours_Period)

3635
..Workbooks(myHoursOnlyName).Worksheets(mSheetName_Hours_Period).Select
'So when user opens sheet the logical tab is selected
3636 .Workbooks(myHoursOnlyName).Save
3637 .Workbooks(myHoursOnlyName).Close
3638
..Workbooks(myDollarsHoursName).Worksheets(mSheetName_Amounts_Period).Select
'So when user opens sheet the logical tab is selected
3639 .Workbooks(myDollarsHoursName).Save
3640 .Workbooks(myDollarsHoursName).Close
 
Back
Top