BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I select a sheet

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Felix A. Hernandez
Guest





PostPosted: Wed Aug 09, 2006 8:12 am    Post subject: How do I select a sheet Reply with quote



I opened an Excel workbook and is on Sheet2 and I need to go to
'MySheet' using TExcelApplication or TExcelWorksheet automation VCL
server. How do I select a sheet and make it the active sheet?

Felix
Back to top
Dennis Passmore
Guest





PostPosted: Wed Aug 09, 2006 2:42 pm    Post subject: Re: How do I select a sheet Reply with quote



Once you have a TExcelApplication (Application_) you can use the
Workbooks property to tell it to open a named saved Excel file
as (fWorkbook).
Now you can use the fWorkbook.WorkSheets property to examine each Item
giving it a "Name" to see it is the WorkSheet you need as (fWorkSheet)
and then just use fWorkSheet.Activate(lcid) to make it the
Active WorkSheet.


Dennis Passmore

"Think it might be a new experience and
if you can not Pull then at least Push
the job will get done"
Back to top
Felix A. Hernandez
Guest





PostPosted: Thu Aug 10, 2006 6:26 pm    Post subject: Re: How do I select a sheet Reply with quote



Dennis Passmore wrote:
Quote:
Once you have a TExcelApplication (Application_) you can use the
Workbooks property to tell it to open a named saved Excel file
as (fWorkbook).
Now you can use the fWorkbook.WorkSheets property to examine each Item
giving it a "Name" to see it is the WorkSheet you need as (fWorkSheet)
and then just use fWorkSheet.Activate(lcid) to make it the
Active WorkSheet.


Dennis Passmore

"Think it might be a new experience and
if you can not Pull then at least Push
the job will get done"

I tried displaying the ExcelApplication1.Workbooks.Item[1].Name property
and that contains the name of the workbook not the name the sheet. I
need to get to a specific sheet by name in the workbook.

ExcelApplication1.Workbooks.Item[1].Name does not work.

ExcelApplication1.ActiveWorkbook.Worksheets['Stand ' + db_stand.Text];
did not work either.

Felix
Back to top
Dennis Passmore
Guest





PostPosted: Thu Aug 10, 2006 10:59 pm    Post subject: Re: How do I select a sheet Reply with quote

I had not done this in a while so I put together a simple example
that I think does exactly what you are trying to do.

Get it from my website at http://www.dpassmore.com/wdata/ExcelTest.zip


Dennis Passmore

"Think it might be a new experience and
if you can not Pull then at least Push
the job will get done"
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.