P
Paul
I have a Development Notes template that I want to add to the front of larger
models that I build.
Having saved the template as a file, I have code that is run from an icon
that should
- identify the activeworkbook
- open the template file
- copy the notes sheet into the activeworkbook
- close the template file
It keeps failing on the second of these two lines, with a 'Subscript out of
range' error
cSheet = Workbooks(cMainWin).Sheets(1).Name
Workbooks(cNotesFile).Worksheets(cNotesFile).Copy
Before:=Workbooks(cMainWin).Sheets(cSheet)
' cNotesFile is the name of the notes template
' cMainWin is the name of the activeworkbook
The first line attempts to get the name of the first sheet in the file (I
originally tried using Sheet(1) but with the same error)
This should be straightforward, but clearly I'm making it more difficult
than it should be - and making it fail at the same time.
Any help would be appreciated
models that I build.
Having saved the template as a file, I have code that is run from an icon
that should
- identify the activeworkbook
- open the template file
- copy the notes sheet into the activeworkbook
- close the template file
It keeps failing on the second of these two lines, with a 'Subscript out of
range' error
cSheet = Workbooks(cMainWin).Sheets(1).Name
Workbooks(cNotesFile).Worksheets(cNotesFile).Copy
Before:=Workbooks(cMainWin).Sheets(cSheet)
' cNotesFile is the name of the notes template
' cMainWin is the name of the activeworkbook
The first line attempts to get the name of the first sheet in the file (I
originally tried using Sheet(1) but with the same error)
This should be straightforward, but clearly I'm making it more difficult
than it should be - and making it fail at the same time.
Any help would be appreciated