Results 1 to 6 of 6

Thread: {Resolved} Fastest VB way to load Excel from .mdb

Threaded View

  1. #1

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    {Resolved} Fastest VB way to load Excel from .mdb

    Hey Guys,

    I have the following routine to load Table data (of an .mdb) into a pre-defined Excel template.

    However, it is VERY slow, is there a quicker way?

    VB Code:
    1. Do While Not rst.EOF
    2.  
    3.         lngRowCntr = lngRowCntr + 1
    4.  
    5.         With objExcel
    6.             .range("A" & lngRowCntr) = Format(rst.Fields("Date").Value & "", "dd/mmm/yyyy")
    7.             .range("B" & lngRowCntr) = rst.Fields("Type").Value & ""
    8.             .range("C" & lngRowCntr) = rst.Fields("Registration").Value & ""
    9.             .range("D" & lngRowCntr) = rst.Fields("PIC").Value & ""
    10.             .range("E" & lngRowCntr) = rst.Fields("Crew").Value & ""
    11.             .range("F" & lngRowCntr) = rst.Fields("Details").Value & ""
    12.             .range("G" & lngRowCntr) = rst.Fields("Landings").Value & ""
    13.             .range("H" & lngRowCntr) = rst.Fields("SE ICUS Day").Value & ""
    14.             .range("I" & lngRowCntr) = rst.Fields("SE ICUS Night").Value & ""
    15.             .range("J" & lngRowCntr) = rst.Fields("SE Dual Day").Value & ""
    16.             .range("K" & lngRowCntr) = rst.Fields("SE Dual Night").Value & ""
    17.             .range("L" & lngRowCntr) = rst.Fields("SE Command Day").Value & ""
    18.             .range("M" & lngRowCntr) = rst.Fields("SE Command Night").Value & ""
    19.             .range("N" & lngRowCntr) = rst.Fields("ME ICUS Day").Value & ""
    20.             .range("O" & lngRowCntr) = rst.Fields("ME ICUS Night").Value & ""
    21.             .range("P" & lngRowCntr) = rst.Fields("ME Dual Day").Value & ""
    22.             .range("Q" & lngRowCntr) = rst.Fields("ME Dual Night").Value & ""
    23.             .range("R" & lngRowCntr) = rst.Fields("ME Command Day").Value & ""
    24.             .range("S" & lngRowCntr) = rst.Fields("ME Command Night").Value & ""
    25.             .range("T" & lngRowCntr) = rst.Fields("ME Co-Pilot Day").Value & ""
    26.             .range("U" & lngRowCntr) = rst.Fields("ME Co-Pilot Night").Value & ""
    27.             .range("V" & lngRowCntr) = rst.Fields("Instrument Flight").Value & ""
    28.             .range("W" & lngRowCntr) = rst.Fields("Instrument Ground").Value & ""
    29.         End With
    30.  
    31.         rst.MoveNext
    32.  
    33.     Loop


    Note: The Excel Workbook is allready set up and pre-saved (lotsa reasons - multi page and the like)so I cant simply dump the Table into Excel.




    Cheers,
    Bruce.
    Last edited by Bruce Fox; Feb 16th, 2004 at 01:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width