Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
need help with simple syntax error
What's wrong with the following???? I get "run-time error '9': Subscript
out of range" on the last line Sub copyfinaldata() Dim finalreportfile As String 'Open the FINALREPORT file finalreportfile = InputBox("Open the final report", "Enter filename", ThisWorkbook.Path & "\test.xls") Workbooks.Open Filename:=finalreportfile Windows(finalreportfile).Activate |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
need help with simple syntax error
add this
DIM WB as Workbook then change this Workbooks.Open Filename:=finalreportfile to SET WB = Workbooks.Open(finalreportfile) to don't need to activate the workbook normally as the newly opened book is usually the active one however WB.Activate this methos gives greater control eg WB.Close False to close without saving HTH Patrick Molloy Microsoft Excel MVP -----Original Message----- What's wrong with the following???? I get "run-time error '9': Subscript out of range" on the last line Sub copyfinaldata() Dim finalreportfile As String 'Open the FINALREPORT file finalreportfile = InputBox("Open the final report", "Enter filename", ThisWorkbook.Path & "\test.xls") Workbooks.Open Filename:=finalreportfile Windows(finalreportfile).Activate . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Syntax Error In Date | Excel Discussion (Misc queries) | |||
Syntax error | Excel Discussion (Misc queries) | |||
syntax error - help | Excel Discussion (Misc queries) | |||
question about syntax in a simple macro... | Excel Discussion (Misc queries) | |||
Vlookup Syntax Error | New Users to Excel |