473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Add DropDown at Runtime Visual Studio Shared AddIn

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.Combo Box.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

Jan 7 '07 #1
2 3549
You can probably do it through OLE automation, but I'm not sure.
You might try posting this to the Excel programming group, and
microsoft.public.vb.ole.automation.

Robin S.
----------------------------
"aferriere" <af*******@gmail.comwrote in message
news:11**********************@q40g2000cwq.googlegr oups.com...
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.Combo Box.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

Jan 7 '07 #2

Figured out how to do this so for any of you guys 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.Val ue)));
xlDropDown=xlDropDowns.Add((double)Target.Left,(do uble)Target.Top,(double)T*arget.Width,(double)Targ et.Height,true);

for (int i=0;i<vaProducts.Length; i++)
{
xlDropDown.AddItem(vaProducts[i],i);
}

Jan 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frédéric Paimparet | last post by:
Hi, When I try to install the prequisite component "Setup Runtime Files" the installation process stop and this component is not installed. I have tried to execute the Bootstrap.msi file...
0
by: seeni | last post by:
I have created an addin to use in visual studio 2002. How to port the addin to Visual studio 2003? When I installed setupmsi in the machine containing visual studio 2003, the addin is not...
2
by: brazilnut | last post by:
Hi. Let me explain the setup. I am using Visual Studio .NET to develop a sort of add-in (COM class) for Excel called SQLAddin. It basically queries a SQL server and pulls in data. Now within my...
30
by: Cowboy \(Gregory A. Beamer\) | last post by:
There seems to be a lot of confusion on the versions of Visual Studio 2005. My latest blog entry covers the different versions: Main URL:...
0
by: Noulouk | last post by:
Hi, I build an add-in for Visual Studio 2005. I use the wizzard, I fixed the bug with envdte reference and build my project immediately after the wizzard. All seems to work, the add-in is shown...
2
by: goHawkeyes | last post by:
I have created a visual studio.net 2005 add-in following the instructions from: http://support.microsoft.com/default.aspx?scid=kb;en-us;816167 The visual studio add-in worked fine in vs 2003...
0
by: Martin Pöpping | last post by:
Hello, I just wanted to install NUnit for Visual Studio from: http://www.netlogics.ch/devcenter/display/NLC/NUnitAddin I followed the installation instructions * Extract the zip contents...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
4
by: =?Utf-8?B?TWFya3Vz?= | last post by:
Hi all How can I make an Addin written in csharp for Visual Studio dockable, so that I can place this addin on the right side of the VS environment? Similar like the "solution explorer", etc.. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.