As the text file that is imported is truly not a workbook, you may not be able to reference it as such. Try using this
ActiveWorkbook.Close
after you have switched to it.
Here is my solution for the worksheet protection problem:
Sub Protect()
On Error GoTo Handler
Range("A2") = 20
ActiveSheet.Protect
Exit Sub
Handler:
ActiveSheet.Unprotect
Resume
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.