• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Somehow Double Workbook object created?

Bhawani

Member
Dear All,

Today i face a new problem on my regular file which i use to compliing some files.
while debugging the same i found Double Workbook object are created in project explorer.
this is the code i am using
Code:
Sub Compiler()
Dim bookList As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")

Set dirObj = mergeObj.Getfolder("C:\Bhawna") 'from this folder files get complied.
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Set bookList = Workbooks.Open(everyObj)

bookList.Worksheets(1).Range("A2:CN" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate 'Getting error here

Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
bookList.Close
Next
End Sub

attached is the screen shot of the same, hope it is clear, these are my doubts
1. How 2 Workbooks could be there (Attached screen shot)
2. Line where i am getting error (Attached screen shot & Code Above)
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    39.3 KB · Views: 5
Back
Top