Solved

Excel vsto iterate named ranges

Posted on 2009-05-13
1
1,024 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

947 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now