![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: OLE Excel Workbook with Workbooks(Index) Topic Summary: How to get a certain workbook from a Workbooks collection ? Created On: 12-Oct-2007 14:47 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi all,
I don´t get it. I want to get a certain workbook Object from Excel out of a Workbooks Collection by Index of the Workbooks. myWorkbook = Workbooks(1) I tried lot of compinations .... but it won´t work :-( |
|
![]() |
|
![]() |
|
Daniel,
There is no actual property called "Index". You need to refer to things by name, if possible. If you know you'll have a workbook "Book1" and a workbook "Book2", use that. If you don't know, open Excel, create a workbook, save it to a known path, then create another and save it to a known path. Close both. Then open both by filename. This way your code knows exactly what it's doing. Good luck. ------------------------- Kevin Murphy http://www.baselinesinc.com The Requirements Management Experts |
|
![]() |
|
![]() |
|
Hi Kevin, Set mySheets = ThisWorkbook.Sheets |
|
![]() |
|
![]() |
|
Here you go Daniel. I would assume getting a workbook from the workbooks collection is similar. Rewrite to fit your needs.
Also see my previous post of all the Excel functions I have. Also I believe someone else recently posted one. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
Hi Daniel,
the attached code will help you to solve your problem ![]() It will allow you to use the following syntax: objWorkbooks[2] to access second element from workbooks (or any other) collection in objWorkbooks. Be carefull, MS uses sometimes Item as method and sometimes as property depending on collection type. Please refer to VBA documentation of the desired collection object for details. Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
Thanks both of you. It works fine.
|
|
![]() |
Telelogic DOORS
» DXL Exchange
»
OLE Excel Workbook with Workbooks(Index)
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.