Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Insert ComboBox into ExcelWorksheet through C#

I'm writing a C# program where I need to go through a loop and add a ComboBox
to an Excel spreadsheet cell. How do I do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Insert ComboBox into ExcelWorksheet through C#

I figured it out. It's actually a DropDown object I'm interested in...

protected static Excel.Application app;
protected static Excel.Range range;
protected static Excel.Workbook wb;
protected static Excel.Sheets sheets;
protected static Excel.Worksheet sheet;
protected static object oMissing = Missing.Value;

range = sheet.get_Range("N1", "N1");
Excel.DropDowns xlDropDowns;
Excel.DropDown xlDropDown;
xlDropDowns = ((Excel.DropDowns)(sheet.DropDowns(oMissing)));
xlDropDown = xlDropDowns.Add((double)range.Left,
(double)range.Top, (double)range.Width, (double)range.Height, true);

//Add items into drop down list
for (int i = 0; i < items.Length; i++)
{
xlDropDown.AddItem(items[i], i + 1);
}
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Insert ComboBox into ExcelWorksheet through C#

I figured it out. It's actually a DropDown object I'm interested in...

protected static Excel.Application app;
protected static Excel.Range range;
protected static Excel.Workbook wb;
protected static Excel.Sheets sheets;
protected static Excel.Worksheet sheet;
protected static object oMissing = Missing.Value;

range = sheet.get_Range("N1", "N1");
Excel.DropDowns xlDropDowns;
Excel.DropDown xlDropDown;
xlDropDowns = ((Excel.DropDowns)(sheet.DropDowns(oMissing)));
xlDropDown = xlDropDowns.Add((double)range.Left,
(double)range.Top, (double)range.Width, (double)range.Height, true);

//Add items into drop down list
for (int i = 0; i < items.Length; i++)
{
xlDropDown.AddItem(items[i], i + 1);
}
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting a picture into unprotected cells in a protected excelworksheet Joel Buhler Excel Worksheet Functions 0 December 31st 09 03:36 AM
How do I add an addtional Excelworksheet tab dlowell31772 Excel Discussion (Misc queries) 3 October 13th 08 04:15 PM
VB code to run a Query in Access and paste results onto an Excelworksheet Tony Bender Excel Programming 5 October 1st 08 08:00 PM
Using Excel Interop via VS.NET 2005 to create and save a new Excelworksheet.. please help! [email protected] Excel Programming 0 January 18th 08 06:39 PM
can one excelworksheet address update a different box on 2nd w/s celia ellis Excel Worksheet Functions 2 January 3rd 07 09:44 PM


All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"