How do i call a procedure

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 1872
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 293 times
Been thanked: 67 times
Contact:

Re: How do i call a procedure

Post by serge_girard » Tue Sep 05, 2017 12:22 pm

Robert,

Try this:

Code: Select all

oExcel:WorkSheets(1):UsedRange:Rows:Count
This will also count empty rows.

Serge

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Tue Sep 05, 2017 2:03 pm

So, go to line no. 65535 and decrease loop control util you reach first not empty row

User avatar
serge_girard
Posts: 1872
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 293 times
Been thanked: 67 times
Contact:

Post by serge_girard » Tue Sep 05, 2017 2:08 pm

Easier:

Code: Select all

 
for i = 1 to oExcel:WorkSheets(1):UsedRange:Rows:Count
  // do somethings
next
 

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Tue Sep 05, 2017 3:01 pm

I didn't know UsedRange. Thank you, Serge!

User avatar
serge_girard
Posts: 1872
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 293 times
Been thanked: 67 times
Contact:

Post by serge_girard » Tue Sep 05, 2017 4:12 pm

Google...internet ... !
New for me too!

Serge

KDJ
Posts: 178
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland
Been thanked: 190 times

Post by KDJ » Tue Sep 05, 2017 5:59 pm

mol wrote:
Tue Sep 05, 2017 6:48 am
...
xlUp is defined in excel.ch as:

Code: Select all

#DEFINE xlUp   -4162
Where is excel.ch, I have not found.

Here is MS Excel documentation in single file (EXCEL 2013 Developer Documentation.chm): https://www.microsoft.com/en-us/downloa ... x?id=40326

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Tue Sep 05, 2017 6:26 pm

I found excel.ch few years ago, I don't remember where. I can post it from my computer

ROBROS
Posts: 61
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Tue Sep 05, 2017 6:52 pm

Serge,

that sounds good,I will try it tomorrow at my office, on my Linux PC I have no excel installed, though I have virtualbox installed I have no licence to install excel.
Mareks proposal for checking for the first empty row doesn't work for me, but:
The last row has a cell always containig the same string (it's a footer row) so I could check instead for this string and then exit the loop.
Or I will check backwards for the first not emtpy row. (sophisicated)
I think this method is sure better, maybe one day they change the footerrow

Btw I think for further questions which I am afraid will occur, I will open a new thread with a new topic.

Guys, you are great, thank you so much.

Robert
Last edited by ROBROS on Tue Sep 05, 2017 7:03 pm, edited 3 times in total.

ROBROS
Posts: 61
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Tue Sep 05, 2017 6:56 pm

mol wrote:
Tue Sep 05, 2017 6:26 pm
I found excel.ch few years ago, I don't remember where. I can post it from my computer
Marek,

that would be great.

ROBROS
Posts: 61
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 32 times
Been thanked: 1 time

Post by ROBROS » Wed Sep 06, 2017 6:44 am

Just to give a feeback:

Serge's suggestion is working. :D

Post Reply