Adding custom properties and assigning values. 
Author Message
 Adding custom properties and assigning values.

Hi there, I'm trying to drop a shape, create custom
properties and then assign values to them.

Here's the code:

Dim locObj As Visio.Shape
Set locObj = visDocument.Pages(1).Drop(locMstObj, i, 4)
locObj.AddNamedRow visSectionProp, "Address1", 0
locObj.Cells("Prop.Address1.Type") = 0
locObj.Cells("Prop.Address1.value") = "beer"

When I do this it gives me an error on the last line that
says, "Type mismatch."

If I assign an integer I have no problems, but I need to
be able to assign a string.

Have I missed some steps in configuring the property?

Thanks in advance.



Wed, 24 Aug 2005 04:15:51 GMT  
 Adding custom properties and assigning values.
Allan

1) For writing strings in cell, you have to use "quotet" strings!
2) Use object.Formula!

in your example, change to:

locObj.Cells("Prop.Address1.Type").Formula = 0
locObj.Cells("Prop.Address1.value").Formula = """beer"""
or locObj.Cells("Prop.Address1.value").Formula = chr(34)& "beer"& chr(34)

--
Regards

Peter Suter

Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

Quote:

> Hi there, I'm trying to drop a shape, create custom properties and then
> assign values to them.

> Here's the code:

> Dim locObj As Visio.Shape
> Set locObj = visDocument.Pages(1).Drop(locMstObj, i, 4)
> locObj.AddNamedRow visSectionProp, "Address1", 0
> locObj.Cells("Prop.Address1.Type") = 0
> locObj.Cells("Prop.Address1.value") = "beer"

> When I do this it gives me an error on the last line that says, "Type
> mismatch."

> If I assign an integer I have no problems, but I need to be able to
> assign a string.

> Have I missed some steps in configuring the property?

> Thanks in advance.



Wed, 24 Aug 2005 05:07:15 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Property access must assign to the property or use its value

2. Need help for assign value to property!!!

3. Excell VBA: Assigning values to .XValues property of Series object

4. Assigning Key value to a record in a table using Property Let Or Get

5. Assign Custom Help to Custom Methods

6. create custom icon,custom combobox(to insert values)in custom toolbar

7. Custom and Builtin Property Values - How to access them

8. How to set programmatically set values of custom added columns

9. Set Custom Property Value through a VB Form

10. Setting values in customs properties

11. Custom Property Cell value

12. Setting Custom Property values for Master

 

 
Powered by phpBB® Forum Software