Hi. I have tried the code below:
I have included a reference to MS excel library 14.0 object library.
The error I am getting is at the line: xlApp.AddIns.Add(Filename:=xlApp.LibraryPath & "c:\Analys32.xll") Please see attachment for error message.
Please advice. Thanks.
HTML Code:
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim oAddIn As Excel.AddIn
xlApp.AddIns.Add(Filename:=xlApp.LibraryPath & "c:\Analys32.xll")
oAddIn = xlApp.AddIns.Item("Analysis ToolPak")
xlApp.RegisterXLL("Analys32.xll")
xlWorkSheet.Cells(1, 1) = 1
xlWorkSheet.Cells(2, 1) = 2
xlWorkSheet.Cells(3, 1) = 3
xlWorkSheet.Cells(4, 1) = 4
xlWorkSheet.Cells(5, 1) = 5
xlWorkSheet.Cells(1, 2) = 3
xlWorkSheet.Cells(2, 2) = 3
xlWorkSheet.Cells(3, 2) = 3
xlWorkSheet.Cells(4, 2) = 2
xlWorkSheet.Cells(5, 2) = 1
' Chart the Histogram on a new Worksheet
' See Microsoft Knowledge Base article 213489
xlApp.Run("Histogram", xlApp.ActiveSheet.Range("$A$1:$A$5"), _
"", xlApp.ActiveSheet.Range("$B$1:$B$5"), _
False, False, True, False) ' True = ChartThe error I am getting is at the line: xlApp.AddIns.Add(Filename:=xlApp.LibraryPath & "c:\Analys32.xll") Please see attachment for error message.
Please advice. Thanks.