1. jay rajan
  2. PowerBuilder
  3. Tuesday, 6 August 2019 07:43 AM UTC

Hi all

I have a code

 

count = lole_source.Application.Workbooks.Count()

sheet_count = lole_source.Application.Workbooks(count ).WorkSheets().count()

 

sheet_count  return correct total no. of sheet on my machine but this sheet_count  return wrong or 0 no. of sheet on my friend machine.

John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 6 August 2019 21:46 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Jay -

Rule out the obvious first: Is Excel installed on your friend's PC?

I'm not an Excel via OLE expert by any means, but the two lines of code you supplied don't look right to me. I believe Count is a property, not a method, in the Excel Object Model, so shouldn't  "xxxx.Count()" instead be "xxxx.Count"? Same for Worksheets...it is a collection, so shouldn't the worksheet count be coded as "xxxx.Worksheets.Count"? I know you can reference a particular item within a collection like this: "Wookbooks(1).Worksheets.Count", but it is not clear to me what you are attempting to accomplish.

Have you put your OLE code within Try...Catch blocks? I have found that using Try/Catch to handle and examine and display info from OLE exceptions is very helpful in debugging MS Office via OLE.

HTH

-john

Comment
There are no comments made yet.
jay rajan Accepted Answer Pending Moderation
  1. Tuesday, 6 August 2019 08:05 AM UTC
  2. PowerBuilder
  3. # 2

and one more thing that i have a window 7 machine but my friend have a window 10 machine

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.