Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 497557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:47:34+00:00 2026-05-13T05:47:34+00:00

I wonder is there a way to replicate insert chart dialog functionality using C#.

  • 0

I wonder is there a way to replicate insert chart dialog functionality using C#. What I need is to display a Popup window, but more importantly to let the user to select data ranges.

I also want ranges highlighted with Excel’s colorfull boxes. Here’s an image of how excel highlights ranges when inserting a chart. I’d like to be able to have these boxes from my C# add-in.

Excel range highlighting http://img696.imageshack.us/img696/5290/excel.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:47:34+00:00Added an answer on May 13, 2026 at 5:47 am

    In VBA there is a RefEdit control that can allow you to do this, and there is a detailed walkthrough on how to use it here: How to Use the RefEdit Control with a UserForm.

    There is no built-in control that can allow you to do this in C#, unfortunately. You could either use VBA as your front-end — which I very much doubt that you’d want to do — or you can create a RefEdit control equivalent using C#. There is an article on how to do this, along with a fully-functional C# code example, here: How to Code a RefEdit control by Gabhan Berry.

    Update based on zzandy’s comment:

    “Actually the question is on how to
    highlight selected ranges, not on how
    to select range. The InputBox
    (csharp-examples.net/inputbox) is
    available from C# and allows to select
    ranges.”

    Getting the ranges to highlight in multi-colors will not be possible. That kind of highlighting only occurs in Excel when creating formulas on the worksheet, not when one is selecting ranges for any other purpose. The only way to create that would require an heroic amount of subclassing, or hooking, and I would not recommend it.

    Some solutions, however, will allow you to at least have a marquee band around the selection (aka “marching ants”). If you use VBA as a front end, you could make use of the built-in RefEdit control, that I mentioned above, which does put the marquee band around the selected range.

    The C# example I gave, above would allow you to use a RefEdit-like control within a C# form, but it would not include the marquee band when making selections — it will simply utilize the standard look when a range is normally selected.

    If you are willing to use a simple input box solution, instead of a control on a form, then that C# example you gave would work (if you use Form.Show() but not Form.ShowDialog()), but it would not show any special marquee band or other highlighting. For a simple input box that does use marquee band selection, you could make use of the Excel.Application.InputBox method, passing in a value of ‘8’ for the ‘Type’, which indicates that the value returned by the ‘InputBox’ method should be an ‘Excel.Range’ data type:

    Excel.Application excelApp = ...;
    
    string prompt = "Please select the range.";
    string title = "Input Range";
    int returnDataType = 8;
    String DefaultRange = oXL.Selection.Address();
    
    Excel.Range myRange = excelApp.InputBox(
                              prompt,
                              title,
                              DefaultRange,
                              Type.Missing,
                              Type.Missing,
                              Type.Missing,
                              Type.Missing,
                              returnDataType)
    

    Hope this helps…

    Mike

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 420k
  • Answers 420k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer 8589934592 is a hard-coded literal? Really? You should at least… May 15, 2026 at 10:41 am
  • Editorial Team
    Editorial Team added an answer you could try using the django email test server? see… May 15, 2026 at 10:41 am
  • Editorial Team
    Editorial Team added an answer Perhaps I'm missing something, but IMO this is the same… May 15, 2026 at 10:41 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.