Click here to Skip to main content
15,887,449 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Exporting Access db to Excel Pin
RedPandinus20-Mar-19 5:20
RedPandinus20-Mar-19 5:20 
GeneralRe: Exporting Access db to Excel Pin
Richard MacCutchan20-Mar-19 5:36
mveRichard MacCutchan20-Mar-19 5:36 
GeneralRe: Exporting Access db to Excel Pin
RedPandinus20-Mar-19 5:51
RedPandinus20-Mar-19 5:51 
GeneralRe: Exporting Access db to Excel Pin
Richard MacCutchan20-Mar-19 6:07
mveRichard MacCutchan20-Mar-19 6:07 
GeneralRe: Exporting Access db to Excel Pin
Dave Kreskowiak20-Mar-19 8:46
mveDave Kreskowiak20-Mar-19 8:46 
GeneralRe: Exporting Access db to Excel Pin
RedPandinus20-Mar-19 20:08
RedPandinus20-Mar-19 20:08 
GeneralRe: Exporting Access db to Excel Pin
Richard Deeming20-Mar-19 12:35
mveRichard Deeming20-Mar-19 12:35 
GeneralRe: Exporting Access db to Excel Pin
RedPandinus20-Mar-19 20:18
RedPandinus20-Mar-19 20:18 
That's a great way to fix this. Thank you Richard Deeming.
In meantime I managed to generate Excel export with below codes and wanted to share:

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim xlApp As Excel.Application
        Dim xlWorkBook As Excel.Workbook
        Dim xlWorkSheet As Excel.Worksheet
        Dim misValue As Object = System.Reflection.Missing.Value
        Dim i As Integer
        Dim j As Integer

        xlApp = New Excel.Application
        xlWorkBook = xlApp.Workbooks.Add(misValue)
        xlWorkSheet = xlWorkBook.Sheets("Sheet1")

        For i = 0 To dgvData.RowCount - 2
            For j = 0 To dgvData.ColumnCount - 1
                xlWorkSheet.Cells(i + 1, j + 1) = dgvData(j, i).Value.ToString()
            Next
        Next

        xlWorkSheet.Columns.AutoFit()
        xlWorkSheet.Rows.AutoFit()
        xlWorkSheet.SaveAs("C:\xxx\xxx.xlsx")
        xlWorkBook.Close()
        xlApp.Quit()

        releaseObject(xlApp)
        releaseObject(xlWorkBook)
        releaseObject(xlWorkSheet)

        MessageBox.Show("xxx C:\xxx\xxx.xlsx", "xxx", MessageBoxButtons.OK, MessageBoxIcon.Information)

    End Sub

    Private Sub releaseObject(ByVal obj As Object)
        Try
            System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
            obj = Nothing
        Catch ex As Exception
            obj = Nothing
        Finally
            GC.Collect()
        End Try
    End Sub
End Class


There are 14 columns and around 2000 row at current Access db I use.
It tooks 4-5 mins to generate Excel report with 8th gen i5 processor/16gb ram PC.
GeneralRe: Exporting Access db to Excel Pin
Richard MacCutchan20-Mar-19 22:52
mveRichard MacCutchan20-Mar-19 22:52 
GeneralRe: Exporting Access db to Excel Pin
RedPandinus20-Mar-19 23:24
RedPandinus20-Mar-19 23:24 
Questiontextbox allowance Pin
Member 1418376915-Mar-19 4:27
Member 1418376915-Mar-19 4:27 
AnswerRe: textbox allowance Pin
Dave Kreskowiak15-Mar-19 4:29
mveDave Kreskowiak15-Mar-19 4:29 
QuestionTyping into 2 different Textbox at same time Pin
RedPandinus13-Mar-19 22:23
RedPandinus13-Mar-19 22:23 
AnswerRe: Typing into 2 different Textbox at same time Pin
Ralf Meier13-Mar-19 22:35
mveRalf Meier13-Mar-19 22:35 
QuestionGetType of variable before deserialization possible? Pin
Sam Marrocco12-Mar-19 15:07
Sam Marrocco12-Mar-19 15:07 
AnswerRe: GetType of variable before deserialization possible? Pin
Ralf Meier12-Mar-19 22:15
mveRalf Meier12-Mar-19 22:15 
AnswerRe: GetType of variable before deserialization possible? Pin
Eddy Vluggen13-Mar-19 0:24
professionalEddy Vluggen13-Mar-19 0:24 
AnswerRe: GetType of variable before deserialization possible? Pin
Dave Kreskowiak13-Mar-19 4:36
mveDave Kreskowiak13-Mar-19 4:36 
QuestionSum data from datagridview with same criteria Pin
Member 1417921111-Mar-19 22:29
Member 1417921111-Mar-19 22:29 
AnswerRe: Sum data from datagridview with same criteria Pin
Richard MacCutchan11-Mar-19 23:40
mveRichard MacCutchan11-Mar-19 23:40 
QuestionHow to add 3 IF conditions at VB Pin
RedPandinus10-Mar-19 22:48
RedPandinus10-Mar-19 22:48 
AnswerRe: How to add 3 IF conditions at VB Pin
Richard MacCutchan10-Mar-19 22:55
mveRichard MacCutchan10-Mar-19 22:55 
GeneralRe: How to add 3 IF conditions at VB Pin
RedPandinus10-Mar-19 23:07
RedPandinus10-Mar-19 23:07 
GeneralRe: How to add 3 IF conditions at VB Pin
Richard MacCutchan10-Mar-19 23:38
mveRichard MacCutchan10-Mar-19 23:38 
SuggestionRe: How to add 3 IF conditions at VB Pin
Richard Deeming11-Mar-19 9:29
mveRichard Deeming11-Mar-19 9:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.