If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Deleting Define Names
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. |
#2
|
|||
|
|||
Deleting Define Names
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. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Souny" wrote in message ... 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. |
#3
|
|||
|
|||
Deleting Define Names
Doug,
Sorry! I posted to a wrong area. It is for Excel. Thanks. "Douglas J. Steele" wrote: 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. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Souny" wrote in message ... 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. |
Thread Tools | |
Display Modes | |
|
|