View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Activating workbook with variable Name

Workbooks(MyFile).Activate

No quotes.

--
Regards,
Tom Ogilvy

Mark Klaus wrote in message
...
Hi,

I'm using VB to open each file in a certain directory,
copy info from each into a file and then closing the
opened file before looping to the next file.

Everything works fine except that I cannot figure out the
correct syntax to reactivate (or get the focus on) each
file after copying from it. The variable name is MyFile
defined as:

MyFile = Dir("F:\common\budget\import\" & "*.xls")

I've tried:

Windows("myfile.xls").Activate
Windows("myfile").Activate
Myfile.Activate

etc. without any luck.

Help greatly appreciated