Solved

Excel vsto iterate named ranges

Posted on 2009-05-13
1
1,030 Views
Last Modified: 2013-11-10
I need to get a list of all the named ranges in excel

I am upgrading code from an the original version of vsto

  For Each myNames In oSheet.Names     'Get all range definitions
                   Mypage.Add(myNames.Name)
    Next

In VSTO 2008 this doesnt work
0
Comment
Question by:JonMny
1 Comment
 
LVL 1

Accepted Solution

by:
akari1910 earned 500 total points
ID: 24382227
Please try this code
Dim App As Excel.Application = Globals.ThisAddIn.Application
Dim ThisWB As Excel._Workbook = App.ActiveWorkbook
        MsgBox(ThisWB.Names.Count)
        For Each n As Excel.Name In ThisWB.Names
            MsgBox(n.Name)
        Next

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question