Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method 'MailEnvelope' of object '_Worksheet' failed [email protected] Excel Discussion (Misc queries) 1 December 7th 05 11:20 PM
Method 'Paste' of object '_Worksheet' failed markline Excel Discussion (Misc queries) 7 May 28th 05 05:02 AM
Method 'Paste' of object '_worksheet' failed Greg Bloom Excel Programming 4 October 18th 04 06:19 PM
METHOD "SELECT" OF OBJECT '_WORKSHEET' FAILED when opening a file Mat Excel Programming 0 July 8th 04 05:13 PM
HELP!!!! -- (Method Range of _Worksheet failed) ERROR! Fusion[_2_] Excel Programming 4 November 24th 03 03:32 PM


All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"