ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using ActiveWorkbook.Names.Add Name:= (https://www.excelbanter.com/excel-programming/282599-using-activeworkbook-names-add-name-%3D.html)

Stuart[_5_]

Using ActiveWorkbook.Names.Add Name:=
 
NG help kindly gave me the following, as a means of 'tagging' a workbook:

ActiveWorkbook.Names.Add Name:="Tag", RefersTo:="Type1", Visible:=False

How can I use this, please?

Say I need to differentiate between 3 types of workbook. How do I apply
type1, type2, type3 (using say, Tag1, Tag2, Tag3) to the workbooks?

As an example, if the value "£" were to be found in Col 5, then it's a type1
workbook, so give the workbook the private name of "Tag1". The user
must not see this name, nor therefore be able to change it.

As I understand it, at a later date, I should be able to check the workbook
when it is opened, and if it's a "Tag1" workbook, then do code suitable
for that type of workbook.

Can a solution be found for both Excel 2000 and '97 users, please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003



Tom Ogilvy

Using ActiveWorkbook.Names.Add Name:=
 
You would use Tag and assign it a value of Type1, Type2 or Type3.

But if you can determine what type it is by looking in column 5, then why
not look in column 5.

In any event,
you would use the code shown to set create the name in each workbook,
changing the "Type1" to the appropriate value.

Then to check the value of Tag

sType = Application.Evaluate(thisWorkbook.Names("Tag").Ref ersTo)

Select Case sType
Case "Type1"

Case "Type2"

Case "Type3"

End Select
--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
NG help kindly gave me the following, as a means of 'tagging' a workbook:

ActiveWorkbook.Names.Add Name:="Tag", RefersTo:="Type1", Visible:=False

How can I use this, please?

Say I need to differentiate between 3 types of workbook. How do I apply
type1, type2, type3 (using say, Tag1, Tag2, Tag3) to the workbooks?

As an example, if the value "£" were to be found in Col 5, then it's a

type1
workbook, so give the workbook the private name of "Tag1". The user
must not see this name, nor therefore be able to change it.

As I understand it, at a later date, I should be able to check the

workbook
when it is opened, and if it's a "Tag1" workbook, then do code suitable
for that type of workbook.

Can a solution be found for both Excel 2000 and '97 users, please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003





Stuart[_5_]

Using ActiveWorkbook.Names.Add Name:=
 
Many thanks for that.

Regards.

"Tom Ogilvy" wrote in message
...
You would use Tag and assign it a value of Type1, Type2 or Type3.

But if you can determine what type it is by looking in column 5, then why
not look in column 5.

In any event,
you would use the code shown to set create the name in each workbook,
changing the "Type1" to the appropriate value.

Then to check the value of Tag

sType = Application.Evaluate(thisWorkbook.Names("Tag").Ref ersTo)

Select Case sType
Case "Type1"

Case "Type2"

Case "Type3"

End Select
--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
NG help kindly gave me the following, as a means of 'tagging' a

workbook:

ActiveWorkbook.Names.Add Name:="Tag", RefersTo:="Type1", Visible:=False

How can I use this, please?

Say I need to differentiate between 3 types of workbook. How do I apply
type1, type2, type3 (using say, Tag1, Tag2, Tag3) to the workbooks?

As an example, if the value "£" were to be found in Col 5, then it's a

type1
workbook, so give the workbook the private name of "Tag1". The user
must not see this name, nor therefore be able to change it.

As I understand it, at a later date, I should be able to check the

workbook
when it is opened, and if it's a "Tag1" workbook, then do code suitable
for that type of workbook.

Can a solution be found for both Excel 2000 and '97 users, please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003




All times are GMT +1. The time now is 01:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com