L
Lilivati
I am trying to identify a workbook as a variable, but GetOpenFilename
is not returning something which can be passed to any of the Workbooks
functions.
My code:
Public modelfile As String
Public nassisfile As String
Sub Workbook_Open()
modelfile = ThisWorkbook.Name
nassisfile = Application.GetOpenFilename(MultiSelect:=False)
Workbooks.Open nassisfile
Workbooks(modelfile).Activate
'it works fine up until this point:
Workbooks(nassisfile).Activate
'I have also tried: Workbooks("nassisfile").Activate
End Sub
The error it gives me is "subscript is out of range"
Please help!
is not returning something which can be passed to any of the Workbooks
functions.
My code:
Public modelfile As String
Public nassisfile As String
Sub Workbook_Open()
modelfile = ThisWorkbook.Name
nassisfile = Application.GetOpenFilename(MultiSelect:=False)
Workbooks.Open nassisfile
Workbooks(modelfile).Activate
'it works fine up until this point:
Workbooks(nassisfile).Activate
'I have also tried: Workbooks("nassisfile").Activate
End Sub
The error it gives me is "subscript is out of range"
Please help!