PC Review


Reply
Thread Tools Rate Thread

Add DropDown at Runtime Visual Studio Shared AddIn

 
 
aferriere
Guest
Posts: n/a
 
      7th Jan 2007
Hi

I have created a shared add in for Excel using Visual Studio.NET 1.1.
Please note I am NOT using Visual Studio Tools for Office. I am trying
to add a combo box to the active worksheet at runtime.
I am not able to figure out what code to do so. The following
approaches DONT work

ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1", Link:=False,
_
DisplayAsIcon:=False, Left:=65.25, Top:=40.5, Width:=72,
Height:=18)

ActiveSheet.DropDowns.Add()

>From within the code the OLEObjects and DropDowns class dont have the

Add method. I can use the Add method from VBA but not from VS.NET. Is
it even possible to do this in VS.NET ?

Thanks

 
Reply With Quote
 
 
 
 
aferriere
Guest
Posts: n/a
 
      7th Jan 2007

Replying to my own post here. But if any of you guys are trying to do
something similiar here is the working code

string []vaProducts={"Water", "Oil", "Chemicals", "Gas"};
Worksheet xlwsSheet;
xlwsSheet = (Worksheet)_excel.ActiveWorkbook.ActiveSheet;
Range Target;
Target = xlwsSheet.get_Range("A9","A9");
Excel.DropDowns xlDropDowns;
Excel.DropDown xlDropDown;
xlDropDowns = ((Excel.DropDowns)(xlwsSheet.DropDowns(Missing.Value)));
xlDropDown=xlDropDowns.Add((double)Target.Left,(double)Target.Top,(double)Target.Width,(double)Target.Height,true);
for (int i=0;i<vaProducts.Length; i++)
{
xlDropDown.AddItem(vaProducts[i],i);
}

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook AddIn can't load outside Visual Studio dxider Microsoft Outlook Program Addins 1 26th Jun 2009 02:18 PM
Outlook Addin Creation using Visual Studio 2008 Silvius Microsoft Outlook VBA Programming 1 21st Apr 2009 02:34 PM
Re: Add DropDown at Runtime Visual Studio Shared AddIn aferriere Microsoft C# .NET 0 8th Jan 2007 04:36 PM
Outlook 2000 addin in Visual studio.net Vijay Sachan Microsoft Outlook Program Addins 0 16th Sep 2003 01:54 PM
Installation of Visual Studio Addin boris Microsoft Dot NET Framework 1 11th Aug 2003 02:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:38 PM.