Results 1 to 4 of 4

Thread: Excel questions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Posts
    80

    Question

    Hi,

    How can I output a report into an Excel spread sheet? Do I need a data control for it?

    More importantly can I manipulate a spreadsheet cell by cell through a VB program?

    Thanks in advance.

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    1. Don't know about the report - I never use the built in report engine - you can export to HTML or Text so Excel might be available. Check the DataReport ExportFormat meth in VB Help.

    2. You can certainly manipulate Excel cell by cell from a VB program.

    The trick is to use Excel to do it. Set a reference to the Excel Object Library and then use something like:

    Code:
    Dim oExcel as Excel.Application
    Set oExcel = New Excel.Application
    
    With oExcel
      .LoadsaMethodsAvailable....
    oExcel will give you access to all of Excels internal methods, Cells, Range etc...

    Good luck.

    Paul.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306

    Cool

    Here´s the code I use for Excel:

    dim X aS OBJECT
    Set X = CreateObject("Excel.Sheet")
    X.Application.Visible = True

    X.ActiveSheet.Rows(int_Row).Font.Bold = True 'fontbold
    X.ActiveSheet.Cells(int_Row, Col).Formula = "'Hello"
    X.ActiveSheet.Cells(int_Row, Col).Formula = 123

    X.ActiveSheet.Cells.Font.Size = 8
    X.ActiveSheet.Cells.Columns.AutoFit
    X.SaveAs App.Path & "\myfile.xls"

    To get more, save a macro in excel with what you want to do and open the code!

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Posts
    80

    Smile Thanks

    Thanks guys.

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