Set Custom Property Value through a VB Form 
Author Message
 Set Custom Property Value through a VB Form

I'm attempting to set the value of a custom property
through a form that I've created.  I routinely get
a "#NAME?" Error and am not able to complete the update.

The following code snippet seems to be where the problem
is occurring:

Dim selObj   As Visio.Selection    'Shapes selection
collection
Dim shpObj   As Visio.Shape        'A shape instance

Public Sub Pass_To_Excel()
Set shpObj =
ThisDocument.Application.ActiveWindow.Selection(1)

End Sub

Public Sub SceneName_AfterUpdate()
   shpObj.Cells("Prop.Scene_Name").Formula = "=" & Chr(34)
& SceneName.Text & Chr(34)
End Sub

Any help is appreciated.



Mon, 29 Mar 2004 07:55:38 GMT  
 Set Custom Property Value through a VB Form
I try to guess what can go wrong, see below...

HTH
 Stefan



Quote:
> I'm attempting to set the value of a custom property
> through a form that I've created.  I routinely get
> a "#NAME?" Error and am not able to complete the update.

> The following code snippet seems to be where the problem
> is occurring:

> Dim selObj   As Visio.Selection    'Shapes selection
> collection
> Dim shpObj   As Visio.Shape        'A shape instance

> Public Sub Pass_To_Excel()
> Set shpObj =
> ThisDocument.Application.ActiveWindow.Selection(1)

Make sure that ThisDocument is not Excel's document (I don't
know if Excel has ThisDocument and all that you refer).
make sure that something is selected, i.e. test if Selection.Count
is 1 (or bigger).
also make sure that this method is called before SceneName_AfterUpdate
also make sure that the shape you refer to here is not deleted until
SceneName_AfterUpdate is called.
Quote:
> End Sub

> Public Sub SceneName_AfterUpdate()
>    shpObj.Cells("Prop.Scene_Name").Formula = "=" & Chr(34)
> & SceneName.Text & Chr(34)

test if shpObj is not nothing.
test if "Prop.Scene_Name" exists with the shape's CellExists method
Quote:
> End Sub

> Any help is appreciated.



Mon, 29 Mar 2004 13:58:18 GMT  
 Set Custom Property Value through a VB Form
This is bizarre.
Yes, I can see that I have selected the correct objects.  
That much is working.

In the debug mode I get the error at this line:
shpObj.Cells("Prop.Scene_Name").Formula = "=" & Chr(34)
& SceneName.Text & Chr(34)

Upon removing the "=" and the Chr(34) I can now get it to
work.  This puzzles me, as many posts in this forum say
you must have the Chr(34) and the "="...

Anyway - it seems to be working...  Insight?

Quote:
>-----Original Message-----
>I try to guess what can go wrong, see below...

>HTH
> Stefan



>> I'm attempting to set the value of a custom property
>> through a form that I've created.  I routinely get
>> a "#NAME?" Error and am not able to complete the update.

>> The following code snippet seems to be where the problem
>> is occurring:

>> Dim selObj   As Visio.Selection    'Shapes selection
>> collection
>> Dim shpObj   As Visio.Shape        'A shape instance

>> Public Sub Pass_To_Excel()
>> Set shpObj =
>> ThisDocument.Application.ActiveWindow.Selection(1)

>Make sure that ThisDocument is not Excel's document (I
don't
>know if Excel has ThisDocument and all that you refer).
>make sure that something is selected, i.e. test if
Selection.Count
>is 1 (or bigger).
>also make sure that this method is called before

SceneName_AfterUpdate

- Show quoted text -

Quote:
>also make sure that the shape you refer to here is not
deleted until
>SceneName_AfterUpdate is called.
>> End Sub

>> Public Sub SceneName_AfterUpdate()
>>    shpObj.Cells("Prop.Scene_Name").Formula = "=" & Chr
(34)
>> & SceneName.Text & Chr(34)
>test if shpObj is not nothing.
>test if "Prop.Scene_Name" exists with the shape's
CellExists method
>> End Sub

>> Any help is appreciated.

>.



Tue, 30 Mar 2004 00:21:28 GMT  
 Set Custom Property Value through a VB Form
You're right. I had the same problem.
If you set a Formula in VB/VC by the Formula property,
and you enclose it by " then Visio takes your formula as
string and does not evaluate it.

Stefan



Quote:
> This is bizarre.
> Yes, I can see that I have selected the correct objects.
> That much is working.

> In the debug mode I get the error at this line:
> shpObj.Cells("Prop.Scene_Name").Formula = "=" & Chr(34)
> & SceneName.Text & Chr(34)

> Upon removing the "=" and the Chr(34) I can now get it to
> work.  This puzzles me, as many posts in this forum say
> you must have the Chr(34) and the "="...

> Anyway - it seems to be working...  Insight?

> >-----Original Message-----
> >I try to guess what can go wrong, see below...

> >HTH
> > Stefan



> >> I'm attempting to set the value of a custom property
> >> through a form that I've created.  I routinely get
> >> a "#NAME?" Error and am not able to complete the update.

> >> The following code snippet seems to be where the problem
> >> is occurring:

> >> Dim selObj   As Visio.Selection    'Shapes selection
> >> collection
> >> Dim shpObj   As Visio.Shape        'A shape instance

> >> Public Sub Pass_To_Excel()
> >> Set shpObj =
> >> ThisDocument.Application.ActiveWindow.Selection(1)

> >Make sure that ThisDocument is not Excel's document (I
> don't
> >know if Excel has ThisDocument and all that you refer).
> >make sure that something is selected, i.e. test if
> Selection.Count
> >is 1 (or bigger).
> >also make sure that this method is called before
> SceneName_AfterUpdate
> >also make sure that the shape you refer to here is not
> deleted until
> >SceneName_AfterUpdate is called.
> >> End Sub

> >> Public Sub SceneName_AfterUpdate()
> >>    shpObj.Cells("Prop.Scene_Name").Formula = "=" & Chr
> (34)
> >> & SceneName.Text & Chr(34)
> >test if shpObj is not nothing.
> >test if "Prop.Scene_Name" exists with the shape's
> CellExists method
> >> End Sub

> >> Any help is appreciated.

> >.



Tue, 30 Mar 2004 14:27:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Setting values to Custom Fields on Custom Forms

2. Setting values in customs properties

3. Setting Custom Property values for Master

4. Setting Custom Property Values

5. Windows forms designer automatically adds code that sets properties of custom controls

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

7. Access File Custom Properties - Setting them from VB

8. Access File Custom Properties - Setting them from VB

9. Custom Field Value Lists on Custom Forms

10. Custom Property changes in Custom Outlook Form

11. how to get custom form and send custom form from VB

12. VB 6 ActiveX Control in Windos Form, can't access any custom properties

 

 
Powered by phpBB® Forum Software