• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1049
  • Last Modified:

Excel vsto iterate named ranges

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
JonMny
Asked:
JonMny
1 Solution
 
akari1910Commented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now