![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Excel Function Call Topic Summary: How to call a simple function in Excel with OLE ? Created On: 17-Oct-2007 10:02 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi,
I´m trying to call a simple VBA function IsNumeric ? But it is a simple function with (with return value bool) and no Object ? I don´t get a clue how to do that. I want to write an import from an Excel Cell. If there is a cell with standard Format and a Number is in the Cell, the string import doesn´t work. :-( . So I think I´ve to check the Cell first if it IsNumer(objCell) = True and then return an Interger instead. After that I can cast the Integer to a string. THX. |
|
![]() |
|
![]() |
|
Daniel,
Instead of using the "Value" property of the Range object to get the contents of the cell, use the "Text" property as shown in my modification of your code. There is no need to check to see if the cell is numeric or not. -Dennis |
|
![]() |
|
![]() |
|
This is just off the top of my head as I don't have time to fool around with code. So take my answer with a grain of salt.
Your VBA function, IsNumeric, returns true or false. The problem is that you need to communicate that to DOORS. I don't believe you can call a function and get the result from DOORS, but could be very, very wrong about that. You should make your function called from a Sub in VBA. The VBA code would look like: Function IsNumeric(C as Range) 'code here end function Sub callIsNumeric(C as Range) call IsNumeric(C) End sub Then you want IsNumeric to actually fill a value in a cell, something like Sheet2, Cell A1. Call the Macro from DXL and then read the value from Sheet 2, Cell A1. Another idea is creating your own custom class with a property and using OLE to get that property. Perhaps someone more versed in DXL OLE Automation can be of more help, but I wanted to give you some ideas in case not. ------------------------- Kevin Murphy http://www.baselinesinc.com The Requirements Management Experts |
|
![]() |
|
![]() |
|
I have a working Import from Excel script but unfortunately my company does not allow me to share it since it was developed with Air Force money so the Air Force technically owns it. I am trying to get it out to everyone here but unfortunately we're going through a buyout right now so the lawyers are busy.
What I can tell you is that yes you should use the Text value of a Cell. This is because for whatever reason, the value property of a Cell is not always set and can return a null which isn't good. Now, the downside of this is that the Text property truncates text at 1024 characters. To get around this, what I do in my script is that if the text is over 1000 characters, I pull the Value property and check that the text I got from the Text property matches the Value property. If not, I use the Value property data. However all this is only done assuming I am importing rich text (an option in my script) since it essentially involves a copy and paste which DOORS can truncate on when copying from Excel (even manually). I looked a lot at the DOORS import from a spreadsheet since I was basically trying to mirror functionality plus add to it. I have many of the same error messages and what not that theirs does. From it though you can get how to handle values that you get and what to do with them. Like what to do with an Integer, a Real, etc. If you need any other help writing your Importer let me know. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
Lol, thx. Sometimes the solutions are so easy :-)
Out of my own interest, do you know how to call a VBA function ? I think about the VBA shell() Function and so on. Thanks David for your hint with the characters i´will have a look at the Spreadsheet script. The support in this forum is really good. Edited: 17-Oct-2007 at 15:02 by Daniel Kübert |
|
![]() |
|
![]() |
|
Daniel,
When you ask how to call a VBA function, do you mean in VBA or how to run a macro in DXL? ------------------------- Kevin Murphy http://www.baselinesinc.com The Requirements Management Experts |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Excel Function Call
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.