LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy sheets to New Workbook - Excel 2007

Hi
I am trying to copy 3 of the 4 sheets in my Excel Workbook to a new
workbook, save the new work book without the macro and close the
original workbook (containing the source sheets) without saving. I
keep getting the following error message on the copy sheet code, even
when I record copying the sheets to a new workbook:

Run time error '1004'
Copy method of Sheets class failed

Sub PrepareWB()
Dim Sourcewb As Workbook

Set Sourcewb = ActiveWorkbook

Application.ScreenUpdating = False
MsgBox "A macro to create your workbook is about to run", , "Macro
Running"
Sourcewb.Sheets(Array("Sale Data 3 Months", _
"3 Year Bus Plan", "Competitor Analysis")) _
.Copy
ActiveWorkbook.SaveAs Filename:= _
"Chocolates Supreme Dashboard.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

---more code---

ActiveWorkbook.Save
Windows("Choclates Supreme.xlsm").Close SaveChanges = False
Application.ScreenUpdating = True

End Sub

 
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
How do you copy saved excel sheets to a new workbook chrisnsmith Excel Discussion (Misc queries) 3 February 14th 09 04:21 PM
How do you copy colour from one workbook to another in Excel 2007 mosesg Excel Discussion (Misc queries) 1 November 28th 08 01:10 PM
Copy a graph within a workbook in Excel 2007 Hubes Charts and Charting in Excel 6 December 13th 07 01:42 PM
Copy Data from Excel 2007 XLSM workbook to Excel 2003 XLS workbook using ADO Andy Excel Programming 2 July 27th 07 10:44 PM
why i cant copy sheets in excel workbook roland Excel Discussion (Misc queries) 1 March 24th 07 02:52 PM


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