Deleting Define Names

  • Thread starter Thread starter Souny
  • Start date Start date
S

Souny

Hello all,

I have define names in my Excel file. Of the define names that I have,
there are particular three define names that I want to delete using the code.
The code that I use is as followed:

for each dName in activeworkbook.names
if dName = "Sheet1!DefineName1" or dName="Sheet1!DefineName2" or
dName="'Sheet 2'!DefineName3" then
dName.delete
end if
next dName

Somehow, the above code is not working and is not deleting those define
names. The above code is a portion of my entire code.

Please help.

Thanks.
 
This newsgroup is for questions about Access, the database product that's
part of Office Professional.

If you're using Access to automate Excel, the line of code

for each dName in activeworkbook.names

is invalid, since Access knows nothing about ActiveWorkbook: you need to
refer to the current instance of Excel for that to be meaningful to Access.

If you're using Excel, you'd be best off reposting to a newsgroup related to
Excel.
 
Back
Top