Solved

Public member 'Minimum' on type 'Worksheet' not found.

Posted on 2007-03-30
3
273 Views
Last Modified: 2008-02-01
Public Function LoadExcelSheet(ByVal dt As DataTable)

        Try

            Dim oApp As New Excel.Application
            Dim xlWorkBook As Excel.Workbook = oApp.Workbooks.Add()
            Dim xlWorkSheet As Excel.Worksheet = CType(xlWorkBook.Worksheets(1), Excel.Worksheet)
            xlWorkSheet = xlWorkBook.ActiveSheet


            xlWorkSheet.Visible = True
            xlWorkSheet.Minimum = 1
            xlWorkSheet.Maximum = dt.Rows.Count + 1
            xlWorkSheet.Value = 1
            ' This is to access the first work sheet of your application
            xlWorkSheet = CType(xlWorkBook.Worksheets(1), Excel.Worksheet)
            xlWorkSheet.Name = "SampleExcel"
            For i As Integer = 1 To dt.Rows.Count
                For j As Integer = 1 To dt.Columns.Count
                    ' This is to add the Data which retrieved from
                    ' the database into your Excel Sheet.
                    CType(xlWorkSheet.Cells(i, j), Excel.Range).Value2() = dt.Rows(i - 1).ItemArray(j - 1).ToString()

                    'dt.Rows[i-1].ItemArray[j-1].ToString()--> This will retrieve
                    ' data from your datatable's
                    '(i-1)th rows (j-1)st column
                Next
                xlWorkSheet.Value = xlWorkSheet.Value + 1
            Next
            '  MessageBox.Show("Your Process Completed Successfully")
            xlWorkSheet.Visible = False
        Catch e1 As Exception
            '  MessageBox.Show(e1.Message)
        End Try


    End Function
0
Comment
Question by:mathieu_cupryk
  • 2
3 Comments
 
LVL 7

Expert Comment

by:dctuck
ID: 18824907
Where exactly does the error occur? Try removing your Try..Catch blocks so you can see the exact line
0
 

Author Comment

by:mathieu_cupryk
ID: 18825052
  xlWorkSheet.Minimum = 1
0
 
LVL 7

Accepted Solution

by:
dctuck earned 500 total points
ID: 18825164
None of these three lines work:

xlWorkSheet.Minimum = 1
xlWorkSheet.Maximum = dt.Rows.Count + 1
xlWorkSheet.Value = 1

What is it you're trying to do in these?
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question