Excel Add-In [Issues while designing]

harpreetgujral

New Member
Joined
Oct 30, 2010
Messages
6
Hello everybody,

I am facing the following issues while working with Excel ADD_INs

1) i have designed an automation which makes allows the user to access the full Macro through a Excel ADD_IN

2) i have used a couple of forms in the the ADD_IN, which are saved in the ADD_IN file

3) The forms used have a couple of Drop_Down Boxes, in order to fill up these boxes with the Data, i am unable to pull data from the Excel ADD_IN file itself, so as a turnaround, i saved the data into another Excel file.

At present, i call the new excel file to open and then show the form to the user, this way i am able to populate the Drop Down Boxes placed on the Form present in the ADD_IN with the right data.

Is there a way to fill these Drop Down Boxes with the data i want the user to view from the ADD_IN file itself? [If there is an sample file, then please send it, i can replicate the concept from that ;)]

Thanks in advance
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,425
How much data are you talking about?

Could you just populate the comboboxes with code:e.g.
Code:
Private Sub UserForm_Initialize()

    With ComboBox1
        .AddItem "Apple"
        .AddItem "Orange"
        .AddItem "Pear"
    End With
    
End Sub
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,425
You should be able to read data from an Add-in sheet as well.

Example:
Code:
x = Workbooks("[COLOR="Red"]MyAddIn.xla[/COLOR]").Sheets("[COLOR="Red"]Sheet1[/COLOR]").Range("A1").Value
 

harpreetgujral

New Member
Joined
Oct 30, 2010
Messages
6
Thanks Alphafrog,

I cannot use the first alternative, since my data is a little huge, i mean about 85 options. So First solution is phased out

I tried using the second option, but the synatax where we use sheetname, i was using .xls in place of .xla, as suggested by you.

Will try using this option.....

Thanks for taking out time

Cheers
Harry
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,425
Eighty items isn't too bad. You could put them into an array and then loop the array to add each item. This example does four items.

Code:
Private Sub UserForm_Initialize()

    Dim arrData1 As Variant
    
    arrData1 = Split("Apple,Orange,Pear,Peach", ",")
    
    For i = 0 To UBound(arrData1)
        ComboBox1.AddItem arrData1(i)
    Next i

End Sub
 

Forum statistics

Threads
1,136,434
Messages
5,675,843
Members
419,586
Latest member
RoteichA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top