Results 1 to 7 of 7
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Excel Object required (Access 2003 SP2)

    I am using automation to populate an excel sheet and i find the following statement objects with an Object Required message:

    x1.Range("A2").Value = ReadCR_DR!AccountNumber

    where ReadCR_DR is a recordset.

    I have defined x1 as:
    Dim x1 as Excel.Application
    Set x1 = CreateObject("Excel.Application")

    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Object required (Access 2003 SP2)

    When you start an instance of Excel using automation, it doesn't open with a blank workbook. So you must either open an existing workbook:

    Dim x2 As Excel.Workbook
    Set x2 = x1.Workbooks.Open("C:ExcelMyWorkbook.xls")

    or create a new one:

    Dim x2 As Excel.Workbook
    Set x2 = x1.Workbooks.Add

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Excel Object required (Access 2003 SP2)

    It does already, this application has been running for quite a while. Silly me decided to put error checking in as there was none previously.

    So it has all the right things except it bombs after i put that line in.

    The application opens atemplate, does the population then saves the wookbook under a different name.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Object required (Access 2003 SP2)

    Could you post a bit more of the code, so that we can see it in its context?

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Excel Object required (Access 2003 SP2)

    Unfortunately no, it's at work.

    What i can tell you, is that the templae had the A column locked, i believe i unlocked it. In the template there is about 33 rows to start with, and when it uses beyond that row, it can paste into column A???

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Object required (Access 2003 SP2)

    Sorry, that's not enough information.

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Excel Object required (Access 2003 SP2)

    Fair enough, thatnks for your help so far.

Posting Permissions

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