Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Selecting a Sheet in Excel Using Automation
Topic Summary:
Created On: 11-May-2005 14:05
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Karen Hidalgo, on Wednesday, May 11, 2005 4:56 PM

Answer:
This is a piece of code I use to get a sheet called "NCMS Export" from an Excel file:

// select front sheet
OleAutoObj objSheets = null
checkRes(oleGet(objExcel, "Sheets", objSheets))

int numSheets = 0
checkRes(oleGet(objSheets, "Count", numSheets))
int s

for s in 1:numSheets do
{
OleAutoObj objThisSheet = null
clear(args)
put(args, s)
checkRes(oleGet(objSheets, "Item", args, objThisSheet))

string thisSheetName = ""
checkRes(oleGet(objThisSheet, "Name", thisSheetName))


if ( thisSheetName == "NCMS Export" )
{
objSheet = objThisSheet
break
}
}

 11-May-2005 14:05
User is offline View Users Profile Print this message


Ken Mcguffie

Posts: 63
Joined: 3-Feb-2004

Hi,

I am struggling to select a sheet in a workbook which I am opening from within DOORS. I can open Excel, then the workbook but I cannot get a handle on a specified sheet.

Any ideas?

Edited: 11-May-2005 at 14:06 by Ken Mcguffie
Report this to a Moderator Report this to a Moderator
 11-May-2005 15:23
User is offline View Users Profile Print this message


Karen Hidalgo

Posts: 55
Joined: 4-Nov-2003

Answer Answer
This is a piece of code I use to get a sheet called "NCMS Export" from an Excel file:

// select front sheet
OleAutoObj objSheets = null
checkRes(oleGet(objExcel, "Sheets", objSheets))

int numSheets = 0
checkRes(oleGet(objSheets, "Count", numSheets))
int s

for s in 1:numSheets do
{
OleAutoObj objThisSheet = null
clear(args)
put(args, s)
checkRes(oleGet(objSheets, "Item", args, objThisSheet))

string thisSheetName = ""
checkRes(oleGet(objThisSheet, "Name", thisSheetName))


if ( thisSheetName == "NCMS Export" )
{
objSheet = objThisSheet
break
}
}



-------------------------
Karen Hidalgo<BR>Northrop Grumman - TASC<BR>karen.hidalgo@ngc.com

Edited: 11-May-2005 at 15:25 by Karen Hidalgo
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.