Hello all - I'm receiving a "missing object" error in the below code. This is only a smidgen of much a much larger code which copies 100 text files into 100 worksheets. The range in File2 may vary, but will never be larger than A1:R55. Any assistance in having this copy/paste without clipboard would be greatly appreciated.
Code:
Public Sub ImportCMS()
Dim File1, File2 As String
File1 = ActiveWorkbook.Name
ws = ActiveSheet.Name
With Sheets("account1")
.Range(.Cells(10, 1), .Cells(64, 18)).ClearContents
End With
File2 = "C:\Users\dturner\Desktop\ServiceLevelsSMS\IntervalScriptOutput\account1.txt"
Workbooks.Open File2
wFile = ActiveWorkbook.Name
With Range("A1:R55")
Windows(File1).Sheets(ws).Range("A10").Resize(.Rows.Count, .Columns.Count).Value = .Value
End With
Application.CutCopyMode = False
Workbooks(wFile).Close False
If ActiveSheet.Name = "Sheet1" Then
Application.GoTo Reference:="mTop"
End If
End Sub