Evaluate a Name in Non-active WB
Your example that works (even if Test2.xls is not active) the .Value
property is in effect the RefersTo string, "=123".
Although it works in the sense it does not error, unfortunately it's not the
solution. But thanks for looking.
Regards,
Peter T
wrote in message
...
Hi
This syntax seems to work
With Workbooks("Test2.xls").Names
.Add "abc", "=124"
v = .Item("abc").Value
.Item("abc").Delete
End With
but this one does not
With Workbooks("Test2.xls").Names
.Add "abc", "=124"
v = [abc]
.Item("abc").Delete
End With
i don't know why not. Anyone?
regards
Paul
On Mar 4, 11:45 am, "Peter T" <peter_t@discussions wrote:
Anyone know the syntax to evaluate a Name in a Workbook that's not the
activeworkbook.
For example, in the following how to return v = 123 if ThisWorkbook is NOT
the active workbook (without using cells).
Sub EvalNameTest()
Dim v
With ThisWorkbook.Names
.Add "abc", "=123"
v = [abc]
.Item("abc").Delete
End With
If IsError(v) Then
v = CStr(v)
End If
MsgBox v, , ActiveWorkbook.Name
End Sub
TIA, Peter T
|