+ Reply to Thread
Results 1 to 2 of 2

Methode 'Cells' of object '_Worksheet' failed

  1. #1
    Filips Benoit
    Guest

    Methode 'Cells' of object '_Worksheet' failed

    Dear All,

    Creating an invoice in excel from Access.adp with SQL-server-data.
    I have about 10 simular functions to create invoices for other clients,
    never had this problem!

    There are 2 types of orders in 1 invoice.
    First i count the orders for each type.
    Then i open excel-template-invoice and write date for each type if present.

    Set xlApp = CreateObject("Excel.Application")
    Set WB = xlApp.Workbooks.Open(strPath & "\" & strFile)
    Set WS = WB.Sheets(1)
    xlApp.Visible = True

    The 2 parts of code for each ordertype are nearly the same.
    If there only are orders of type 1 there are no problems, the invoice is
    correctly created and saved.

    BUT, the code for type2 triggers error -2147221080 Methode 'Cells' of
    '_Worksheet' failed.

    This is the codeline that trigger the error
    MsgBox iRow ' shows a correctly the rowNr before the error
    WS.Cells(iRow, 1).Value = "Tokyo"

    After a hole day of looking, testing, stress i'm totally stuck!

    Please HELP!

    Filip



  2. #2
    Jan Karel Pieterse
    Guest

    Re: Methode 'Cells' of object '_Worksheet' failed

    Hi Filips,

    > This is the codeline that trigger the error
    > MsgBox iRow ' shows a correctly the rowNr before the error
    > WS.Cells(iRow, 1).Value = "Tokyo"
    >
    > After a hole day of looking, testing, stress i'm totally stuck!
    >


    Are you sure Sheets(1) is a worksheet and not some other sheet, like a
    chart or a dialogsheet?

    Or maybe Sheets(1) is protected?

    Regards,

    Jan Karel Pieterse
    Excel MVP
    www.jkp-ads.com


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1