Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Copy Sheets
Dim sName as String, Icounter as Long Dim oBook as Workbook sName = Activeworkbook.FullName set oBook = ActiveWorkbook For iCounter = 1 To 275 oBook.Worksheets(1).Copy After:= _ oBook.Worksheets(oBook.Worksheets.count) 'Save, close, and reopen after every 2 iterations: If iCounter Mod 100 = 2 Then oBook.Close SaveChanges:=True Set oBook = Nothing Set oBook = Application.Workbooks.Open(sName) End If Next End Sub or to do it every time Sub Copy Sheets Dim sName as String, Icounter as Long Dim oBook as Workbook sName = Activeworkbook.FullName set oBook = ActiveWorkbook For iCounter = 1 To 275 oBook.Worksheets(1).Copy After:= _ oBook.Worksheets(oBook.Worksheets.count) 'Save, close, and reopen after every 1 iterations: ' If iCounter Mod 100 = 2 Then oBook.Close SaveChanges:=True Set oBook = Nothing Set oBook = Application.Workbooks.Open(sName) ' End If Next End Sub -- Regards, Tom Ogilvy wrote in message ups.com... Totally Baffled!..It comes up the copy error every 15th copy. I've done this 3 times now (it copies 6, saves, closes then opens) and even during third time I even copied the file from the network to the local hard disk and continued the run from there and it still failed on the 15th attempt....It's looking more like I'm going to have to log out of windows every time!?!....help ..I've got alot of these to do.......... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Method of Worksheet Class Failed | Excel Programming | |||
Copy Method of Worksheet Class Failed | Excel Programming | |||
Copy Method of Worksheet Class Failed | Excel Programming | |||
Copy Method of Worksheet Class Failed | Excel Programming | |||
Copy Method of Worksheet Class Failed | Excel Programming |