Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #11  
Old 06-02-2008, 12:45 PM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default RE: Excel.

Try to add the delay:

oSheet := oExcel.Workbooks[1].Worksheets['Sheet1'];
Sleep(5000);
cBid := StrToFloat(oSheet.Cells[r,10]);

PS: play with number of seconds in Sleep()


With best regards, Mike Shkolnik
http://www.scalabium.com
Reply With Quote
  #12  
Old 06-03-2008, 02:01 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default RE: Excel.

I've done that (see the commented lines) with no luck. The thing I think should be done is to prevent Excel form updating (reading from the third-party program) unless my program request an update (by code) to excel. At that time excel should update those hyperlinks and then stop so my program can read the data from excel. What I need to do this is the code to control excels through OLE. I tried "oExcel.CalculateFullRebuild" and some other methods but I do not think they are the right ones. Any suggestions?


NOTE: The third-party program is the program that shows the stock-market prices and transactions. So it gets updated many times in every second.

Regards,
Abdulaziz Jasser
Reply With Quote
  #13  
Old 06-03-2008, 02:06 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default RE: Excel.

Another way is read the data from the third-party program. The third-party program shows the data (prices, quantities, bids, offers, transactions, etc) and in a grid similar to excel or TStringgrid and I believe it was written with Java. Is it possible to read the data from it directly?

Regards,
Abdulaziz Jasser
Reply With Quote
  #14  
Old 06-04-2008, 02:26 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default RE: Excel.

Mike,

Did you find anything wrong with my code?



Regards,
Abdulaziz Jasser
Reply With Quote
  #15  
Old 06-04-2008, 06:43 AM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default RE: Excel.

Try to add the next line:
appExcel1.AskToUpdateLinks = False;

Just after CreateOLEObject()

With best regards, Mike Shkolnik
http://www.scalabium.com
Reply With Quote
  #16  
Old 06-04-2008, 07:32 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default RE: Excel.

This helps a little. Now how prevent excel from updating the links and again ask it to update. I want do something like this:

[DELPHI]while True do begin
//1- Ask excel to update.
//2- Stop excel from updating.
//3- Read the data from excel
//4- Sleep(2000).
end;[/DELPHI]

Regards,
Abdulaziz Jasser
Reply With Quote
  #17  
Old 06-05-2008, 08:40 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default RE: Excel.

Mike,
Any more suggestions?

Regards,
Abdulaziz Jasser
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 06:40 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.