View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Thomas[_18_] Thomas[_18_] is offline
external usenet poster
 
Posts: 3
Default VBA - Syntax filename rangename for vlookup formula

Hello,

I am trying to automate some tasks in vb (Excel 200 SP3) and need to set
a range name to refer to another workbook and rangename to use in a
vlookup formula.

Dim Check As Variant
Dim Result As Variant
Dim Bus_Unit As Variant
Dim Look_Table As Range

Set Look_Table = Names("I:\OPA\Financials\DOO
Macros.xls!AOP_Children").RefersToRange
...
...
...
... more code

When it was simply
Set Look_Table = Names("AOP_Children").RefersToRange

with the range in the current workbook all works fine, but no luck when
I try and refer to an external (opened) workbook. I am getting a
runtime error 1004.

Obviously something simple in my sintax but I cannot see it.
File exists, range name exists and is open.

Any help would be appreciated.

Thanks
Thomas



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!