05-05-2009 08:13 AM
Hello,
I want to take some information out of a EXCEL-Sheet and write these into DIAdem Group properties. Therefore I use following program code:
groupprop_name = get_header.Sheets("Header").Cells(L,11).Value
head_line_entry = get_header.Sheets("Header").Cells(L,6).Value
Call Data.Root.ChannelGroups(1).Properties.Add(groupprop_name, head_line_entry)
Unfortunately I get error message with text:
German:
"Die Eigenschaft XXXXX kann mit einem Wert vom Typ vbString nicht erzeugt oder beschrieben werden."
English:
"Group property XXXXX can not be created or written with value type vbString."
Excel cells are formated as text. I've tried several possibilities to convert the readed cell entry, but nothing has worked.
Do anyone have some helpful information for me how to solve this problem?
Thanks in advance
Sven
05-05-2009 08:23 AM
Hi Sven
In the help of "Add for Channels" the possible data types are listed. It must be one of these strings: "DataTypeFloat64", "DataTypeDate", or "DataTypeString". So in your case you have to use "DataTypeString".
Hope this helps.
Winfried
05-05-2009 08:27 AM
Thanks for answer!
Both data types are string, so it should be no problem to change it. Do you have any idea how to set the data type for the property as "DataTypeString"? I need to convert my string into this "DataTypeString".
05-05-2009 09:01 AM
Hi Sven
I tried your script with my excel table and it works without any problems. You can enter the format of the property as third optional parameter. Have checked that the strings are valid strings (you use a variable "L" in the Cell property)? Or try to convert the "strings" again to strings with the command CStr.
Winfried
05-05-2009 09:05 AM
I tried as well using a new TDM-File without any group properties and it worked too. The error occours only, if I try to add an entry, which already exists (value was novalue). So I can avoid this problem by delete any group properties before create new ones.
Thanks again for help!
05-05-2009 09:16 AM
Hi Sven,
If you omit the data type as the third parameter DIAdem tries to determine the format. You can not change the format of an existing property with the method add. So create it with the correct format or delete each time you change the format.
Winfried
05-05-2009 09:30 AM
I've written the property before while I debugged m scripts and I've not delete them. So I've add the property, filled with NoValue (because my Excel cell was empty), then I've tried to add them again, but this time filled with a string (because my Excel cell was NOT empty this time).Seems, that my problem occured because I've tried to change the data type of property by adding it again.
No I'm clear!
Thanks