Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    106

    Unanswered: Opening and editing Excel from Access Code

    I would like to open Excel, type values in the first four cells, run a macro in Excel and then close the book.

    I have:

    Dim Excel As Object
    Set Excel = CreateObject("Excel.Application")
    Excel.Application.Visible = True ' or false
    Excel.Application.workbooks.Open filename:="Filename.xls"
    Excel.Application.Run "FormatBook" ' comma-sep arg list
    Excel.Application.Quit
    Set Excel = Nothing


    Can anyone help with editing the values?

    Thanks,

    Dan

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    ** DISCLAIMER: This post not intended to flog my crappy little site**

    This is the code I refer to when I want to use Excel. If you actually want to type something in the book instead of sending data to cells, you need to show the excel object you create

    http://members.rogers.com/homerboo/A...O%20EXCEL.html

    The line: xlSheet.Range("A1").Value = "ValueA" shows how to put values in specific cells.

    HTH.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Aug 2003
    Posts
    106

    Thanks

    Thanks for this!!

    Dan

Posting Permissions

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