locked
change Excel chart type based on drop down selection RRS feed

  • Question

  • I have develop code to open excel file and draw chart inside it then I have creat dropdown list to change the chart type. however the chart does not change if user select for dropdown list ???

    anyone help me??

    var list= Sheet.DropDowns();
    			list.Add(100, 150, 70, 20);
    			list.BringToFront();
    			var listDrop = workbook.Worksheets(1).DropDowns(1);
    			listDrop.Visible= true;
    			var items = ["Line Graph", "Pie", "Bar Graph"];
    			for (var i = 0; i<items.length; i++){
    				listDrop.AddItem(items[i], i+1);
    
    				Excel.Application.ScreenUpdating = true;
    				Excel.Application.EnableEvents = true;
    				Excel.Application.DisplayAlerts = true; 
    			}
    				var index = listDrop.ListIndex;
    				switch(index)
    				{
    				case 0:
    				   return ch1.ChartType = -4100;
    				case 1:
    				   return ch1.ChartType = -4101;
    				case 2:
    				   return ch1.ChartType = -4102;
    				case 3:
    				  return ch1.ChartType = 60;	
    			}
    			
    		}

    Wednesday, March 5, 2014 4:23 PM

All replies