PDA

View Full Version : how came wb close by module showing in VBAProject window?



rrosa1
04-10-2011, 02:01 PM
hi
i have this code to create and copy past data from one wb to the anther and create one wb.code work but sometime it give "Device I/O error"
and code close the wb All Data but if i check in VBAProject window it show the VBAProject(All Data.xls)
hear i am ateching the wb but u need to change the dir path to run the code.

i think in this line i am doing something wrong.

Set WB = Workbooks.Open(FileName:=FILE_PATH & FILE_NAME)
ThisWorkbook.Worksheets("Rev").Activate
With Sheets("Rev")
.Move after:=WB.Sheets(WB.Sheets.Count)
End With
On Error Resume Next
WB.Worksheets(sname).Delete
On Error GoTo 0
WB.Sheets("Rev").Name = sname
WB.Save
WB.Close
'WB.Close SaveChanges:=True
this code is the product of this forum help and i add 3 module in one to run only one time
any help is appreciated.
thanks a lot for your time to look in my problem.
p.s. there is no pw sh r just protected without pw.