Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel, checking to see if a range name exists
Message
From
04/08/2004 13:33:37
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00930432
Message ID:
00930717
Views:
10
>**This seem to let me use an range name that's on sheet1 on sheet2.
>** then when I look in excel the ranges names for each sheet are differntiated like this
>
>** name sheetX
>** LastDay Sheet1!
>** LastDay Sheet2!
>
>mySheetIs = alltrim(oExcel.ActiveSheet.name)
>.range(myOwnRange).name = MyOwnName && give this cell this name
>nam = ALLTRIM(oexcel.range(MyOwnRange).name.name) && what name to a variable
>IF .not. "!"$nam
>nam = mySheetIs + "!" + nam && this lets you use the same name again as far as I can see
>endif
>ref = oexcel.range(MyOwnRange).name.RefersToR1C1 && get the r1c1 reference
>oexcel.Names.add(nam, ref) && make sure the range name is added won't make copies

As long as you've given it a different name, it will show up in the list. You could use any convention you wanted to to differenciate the sheets.

You could also check the .RefersTo property to see if your sheet name is in there. Check the help file on how to make a name available on multiple sheets.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform