Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Copy & Delete

Hi,

I have a selection of code that currently makes a copy of the exsisting
workbook and then zips and emails that copy using Outlook, I know this might
sound hopeful but is it at all possible to delete a worksheet out of the copy
before it gets zipped and emailed.

Thanks
Phil
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Copy & Delete

try:

Thisworkbook.savecopyas "NewFileName.xls"
Set NewBook=workbooks("NewFileName.xls").open
with newbook
application.displayalerts=false
.sheets("sheetName").delete
application.displayalerts=true
end with
'then your code for e-mailing etc



"Phil" wrote:

Hi,

I have a selection of code that currently makes a copy of the exsisting
workbook and then zips and emails that copy using Outlook, I know this might
sound hopeful but is it at all possible to delete a worksheet out of the copy
before it gets zipped and emailed.

Thanks
Phil

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Copy & Delete

Hi Rob,

After a lot of searching sites, I have finally got it all working, I'm
arfaid I hacked your original code up a bit and I'm not sure if this is the
best way to write it but it works....


ThisWorkbook.SaveCopyAs "c:\test\copy.xls"
Application.Workbooks.Open ("c:\test\copy.xls")
Application.DisplayAlerts = False
Sheets("Sheet1").Delete
ActiveWorkbook.Close savechanges:=True
Application.DisplayAlerts = True

Thanks for all the help, wouldn't of got this far otherwise.

Thanks Phil


"Phil" wrote:

Hi,

I have a selection of code that currently makes a copy of the exsisting
workbook and then zips and emails that copy using Outlook, I know this might
sound hopeful but is it at all possible to delete a worksheet out of the copy
before it gets zipped and emailed.

Thanks
Phil

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
Copy column header to next column, delete & delete every nth colum genehunter New Users to Excel 1 June 2nd 09 03:57 PM
Clear and Copy vs Delete Barry Lennox[_2_] Excel Discussion (Misc queries) 2 December 19th 08 08:46 PM
cut and delete a row then insert and copy lmch New Users to Excel 1 October 10th 07 11:38 AM
Copy & Delete Phil Excel Programming 1 April 21st 05 05:42 PM
Copy, Paste then delete Louise Excel Programming 2 March 22nd 05 03:41 AM


All times are GMT +1. The time now is 06:03 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"