Home » Developer & Programmer » Forms » Client OLE2 excel rowcount (Forms 10G, windows xp)
Client OLE2 excel rowcount [message #461568] Fri, 18 June 2010 23:23 Go to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

I'm counting the number of rows of my excel file and I don't want to do loop here so I use Client_OLE2. I found sample code on net but it is giving me total number of used rows. The problem is, when I have excel sheet with 100 rows and I delete 50 rows, this code give me 100.

I need the count of existing rows only. Can anyone help me to modify this code?

    args:= Client_OLE2.create_arglist; 
    darange := Client_OLE2.GET_OBJ_PROPERTY (worksheet, 'UsedRange');
    darow := Client_OLE2.GET_OBJ_PROPERTY(darange, 'Rows');
    row_cnt := Client_OLE2.get_num_property(darow,'Count');
		msg('Row count: ' || row_cnt);
		Client_OLE2.destroy_arglist(args);		
    /* release */
    Client_OLE2.Release_Obj(darange);
    Client_OLE2.Release_Obj(darow);
Re: Client OLE2 excel rowcount [message #465140 is a reply to message #461568] Mon, 12 July 2010 21:51 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
'COUNTBLANK' will return the number of empty rows and this could be subtracted from the number returned by 'COUNT'. Also look at 'COUNTIF' and whether 'COUNTBLANK' can be done in a 'negative' sense.

David
Previous Topic: Format Mask to Char Field
Next Topic: using Webutil to get ip address on form load
Goto Forum:
  


Current Time: Fri Sep 20 09:27:16 CDT 2024