If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Here is a description

I have a Code that does Calculation on Multiple spreadsheets.
It first delete all the spreadsheets except from the Inputs one.
and then rebuild sheet by sheet.

Now all the figures come out as i expect.
My code creates a new spredsheet with some kind of average results
and draw charts automatically.

I output the charts as object.
There are 5 of them per subject, so i've put them on the top of each other.

Now i want to add a Listbox (from the vba code) that puts the graph i select in front.

However way i have tried to do it, this does not work.
What does not work is my list box.

I cannot succeed from the code to do these three steps
1) build a listbox,
2)fill it with the names from an array and
3)tell this list box to run a macro when clicked.

It is step 2 that fails when i execute from my code.

Now i have tried with a MACRO, here is the code:
--------------------------------------------------------
This creates the listbox, fills it with some cells from the spreadsheet "inputs" and refer the other macro WHen_Clicked when there is a click to select.
--------------------------------------------------------
Sub Macro3()
' Macro3 Macro
' Macro recorded 27/08/2002 by QDB
ActiveWindow.Visible = False
Windows("DCContsGuarantee_QVersion4.xls").Activate
ActiveSheet.ListBoxes.Add(906, 272.25, 87.75, 129.75).Select
With Selection
.ListFillRange = "Inputs!$N$2:$N$7"
.LinkedCell = ""
.MultiSelect = xlNone
.Display3DShading = False
End With
Selection.OnAction = "WHen_Clicked"
End Sub

If i run this Macro on its own, everything runs fine all the time.
If i call this from my code it breaks at the .ListFillRange = "Inputs!$N$2:$N$7" returning an error:Run-Time Error '438' Object doesn't support this property or method.

How come does this work a a macro called independently but not when i call this macro from the code ?