Activate workbook using a variable?
Can anyone tell me why the line below is not working?
Dim ScorecardFile As String
Sub StartOpen()
ScorecardFile = "C:\Scorecard\TestingNew\PopPVs.xlsx"
Application.Run "SoftcodeFileOpen"
End Sub
Sub SoftcodeFileOpen()
Workbooks.Open Filename:=ScorecardFile
Windows("PopRatings.xlsx").Activate
Windows(ScorecardFile).Activate '************This line causes the error below
End Sub
Error:
Run-time error: 9
Subscript out of range
I've also tried the following and it gets the same error:
Windows("ScorecardFile").Activate
Can anyone tell me how to activate workbooks using a varibale like I open the workbook above?
Bookmarks