LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Reference a workbook level named variable.

Hello,
I have a situation where 2 workbooks are open simultaneously, and I’m trying to reference a named variable (workbook scope) in the inactive workbook.. While experimenting I ran into this.

Dim w As Workbook
Dim s As Worksheet

Set w = ThisWorkbook
Set s = w.Sheets("sheet1")

w.Names.Add ("Bk"), 99
s.Names.Add ("Sht"), 98

Debug.Print s.[sht] 'this works
Debug.Print w.[Bk] 'this raises an error

End Sub

I must be missing something simple, but for the life of me, I can’t figure out why w.[bk] is raising an error. Appreciate any help on this.

Regards,

DaveU
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set macro security level to 'low level' on opening a certain workbook. andreashermle Excel Programming 2 November 15th 10 06:33 AM
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Excel Programming 3 December 24th 07 01:15 PM
Named range in chart - any way to change the workbook reference with VBA Graham Whitehead Excel Programming 1 October 23rd 07 03:02 PM
Concatenate a reference to named ranges in other workbook sbardon Excel Worksheet Functions 4 October 15th 06 01:58 AM
Why, when I create workbook-level name does it jump it to Sheet-level ? Charles Jordan Excel Programming 1 November 5th 03 08:43 PM


All times are GMT +1. The time now is 08:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"