Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

how to generate an Excel 2010 histogram from VB.NET...

$
0
0
Hi. I have tried the code below:

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 = Chart

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.
Attached Images
 

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>