I am attempting to copy a worksheet from an unopened workbook into an open (the active) workbook. My method is getting errors.
First, here is the code I'm using:
Next, the error message I'm getting:
Any suggestions? It may be that I have to first open the other workbook, but I was hoping I could do it without opening it. But if I have to, I will.
--
"If to err is human, then I must be some kind of human!" -Me
First, here is the code I'm using:
Code:
Dim strWS As String 'ws1 name
Dim strWBPath 'To store the path and name of active workbook
strWS = ws1.Name
strWBPath = ActiveWorkbook.Path & ActiveWorkbook.Name
[HIGHLIGHT]Workbooks("\\networkpath\Folder\WorkbookFrom.xls").Sheets("Query"). _
Copy After:= Workbooks(strWBPath).Sheets(ws1.Name)[/HIGHLIGHT]
Next, the error message I'm getting:
Run-time error '9':
Subscript out of range
Any suggestions? It may be that I have to first open the other workbook, but I was hoping I could do it without opening it. But if I have to, I will.
--
"If to err is human, then I must be some kind of human!" -Me