Results 1 to 3 of 3

Thread: Excel Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Posts
    135

    Talking

    hi,
    Can some please help me.. Need to be able to export data to an excel spread sheet. If you can could you please write the code to create and excel file so that i can export data to certain rows and columns..

    Thanks to everyone for your help!

    cheers

    Jason B


  2. #2
    Guest

    Wink Jason don't have code in front of me will post Friday

    Need to know what you exactly mean by create data....from a vb app, extracted from binary file...copied from mdb. Believe me makes major difference. Also what version of vb.

    Will post solution tommorrow, this is an area l have been working in over the last couple of months

  3. #3
    Guest

    Ok back again

    You need to first add the reference to MS Excel Objects to your project. (Under the Project top menu).

    '
    'OK in General
    '
    Private oExcel as Object
    Private oExcelSheet as Object
    '
    'In Form Load or where required
    '
    Do Events
    Set oExcel = CreateObject("Excel.Application")
    '
    ' Error out if Exel not on machine
    '
    If Err = 429 Then
    MsgBox Str(Err) & " : " & Err.Description...etc
    '
    ' Do whatever
    '
    End If
    '
    ' Add a worksheet, and the set the Excelsheet Option
    '
    oExcel.Workbooks.Add
    Set oExcelSheet = oExcel.ActiveWorkbook.Sheets(1)
    '
    ' Ok this stuff allows access to your worksheet...normally ' added after building the data in it etc.
    '
    oExcel.Visible = True
    oExcel.WindowState = xlMaximized
    oExcel.Interactive = True

    Hows that for a first tutorial. Ok a few points, am using vb sp3 and when added oExcel stuff vb does not give a list of properties and methods.

    Exactly how do you want to add data to your new Excel iteration??????

    If you need to do anything real tricky...the easy way is to record a macro and manually do it in Excel. Then look at the vba code....yes l know you generally need to modify it somewhat but these are the breaks.

    Hope this helps

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