I am getting a below error while accessing excel second time

run time error 1004 method sheets of object_global failed in vb6

When i run the code at first time to open a excel and take a copy of the sheet, it works fine however when i run the code second time am getting the above error

Please find the code snippet where exactly am getting error

For N = i - 1 To 0 Step -1
        xlTmp.Sheets("Practice_wise_Summary").Copy Before:=Sheets("3")
        xlTmp.Sheets("Practice_wise_Summary (2)").Select
        xlTmp.Sheets("Practice_wise_Summary (2)").Name = P(N) & "_Summary"
        MyRecSet1.CursorLocation = adUseClient
        xlTmp.Cells(3, 2).Value = P(N)
            MyRecSet1.Open ("Exec [SP_PRACWISESUMMARY1] '" & P(N) & "'"), MyConn, adOpenForwardOnly
            With MyRecSet1
            Do While Not .EOF
            xlTmp.Cells(MyRecSet1![RowIdinExcel], MyRecSet1![ColIdinExcel]).Value = MyRecSet1![Metrics]
            End With
            MyRecSet1.CursorLocation = adUseClient
            MyRecSet1.Open ("Exec [SP_PRACWISESUMMARY2] '" & P(N) & "'"), MyConn, adOpenForwardOnly
            C = MyRecSet1.RecordCount
            Cel = Array(7, 9, 10, 11, 12)
            For j = 0 To MyRecSet1.Fields.Count - 1
            K = 7
            Do While Not MyRecSet1 Is Nothing And Not MyRecSet1.BOF And Not MyRecSet1.EOF
                xlTmp.Cells(K, Cel(j)).Value = MyRecSet1(j).Value
                K = K + 1
            Next j
    Next N

The error coming when the VB reading the below line

xlTmp.Sheets("Practice_wise_Summary").Copy Before:=Sheets("3")

Please help me whats wrong in the code. I have added the below line at the end of the code but even then i am getting the error

Set xlTmp = Nothing

Sorry the solution is

Need to mention Excel object reference everwhere you use Excel objects

xlTmp.Sheets("Practice_wise_Summary").Copy Before:=xlTmp.Sheets("3")
This question has already been answered. Start a new discussion instead.