Solved

Excel vsto iterate named ranges

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

760 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

17 Experts available now in Live!

Get 1:1 Help Now