 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Nicolae Fieraru Guest
|
Posted: Mon Sep 12, 2005 1:24 am Post subject: Refresh information from Excel spreadsheet |
|
|
Hi All,
I am working on a program that has to read a value from an Excel file.
I use Borland C++ Builder, but I hope I will find help in here.
The Excel document I am using gets written by another program that
dumps information into one spreadsheet every few seconds.
What I want to do is to be able to click repeatedly on the button and
to show the new values from the spreadsheet.
Because in the end I will use a function on timer to read the values,
and the refresh period is about 5 seconds, I suppose I must leave the
ExcelApplication open in my program, just to requery somehow the
spreadsheet.
Regards,
Nicolae
Here is the code I use:
void __fastcall TForm1::FormActivate(TObject *Sender)
{
ExcelApplication1->AutoConnect = false;
ExcelApplication1->ConnectKind = ckNewInstance;
ExcelWorkbook1->AutoConnect = false;
ExcelWorkbook1->ConnectKind = ckAttachToInterface;
ExcelWorksheet1->AutoConnect = false;
ExcelWorksheet1->ConnectKind = ckAttachToInterface;
ExcelApplication1->Workbooks->Open(StringToOleStr("C:\MyExcelFile.xls"));
ExcelApplication1->set_Visible(LOCALE_SYSTEM_DEFAULT,false);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Excel_2k::RangePtr Cell;
ExcelWorksheet1->ConnectTo(ExcelApplication1->Worksheets->get_Item((TVariant)1));
Cell=ExcelWorksheet1->get_Range((TVariant)"G13", (TVariant)"G13");
Edit1->Text=OleVariant(Cell->get_Value());
}
|
|
| Back to top |
|
 |
Riki Wiki Guest
|
Posted: Fri Sep 16, 2005 6:50 pm Post subject: Re: Refresh information from Excel spreadsheet |
|
|
On Mon, 12 Sep 2005 01:24:00 GMT, Nicolae Fieraru wrote:
| Quote: | I hope I will find help in here.
|
Hoi Nicolae
You need to repost your message on the Borland newsserver.
Take a look here:
<http://tinyurl.com/8m5nw>
which links to
<http://delphi.wikicities.com/wiki/Delphi_Newsgroups>
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|