View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Activating Open Workbooks using VBA

'For unsaved workbooks the extension will not be there.
Workbooks("book1").Activate

'For saved workbooks use the extension
Workbooks("book1.xls").Activate

If this post helps click Yes
---------------
Jacob Skaria


"JC" wrote:

Do the workbooks have to be saved before you can activate a workbook using
the Workbooks("abc.xls").Activate command? I can find nothing that suggests
that they need to be. I have two workbooks created from a template that at
the time of running the macro will be unsaved. When attempting to use the
Workbooks.Activate command I get a subscript out of range error which I am
assuming relates to the fact that they are not saved files, however they are
open.

Any assistance to a learner would be greatly appreciated.