Driving a Visio Draw

A

Alvaro

This code works to drive a visio drawing embeded in a mathacad worksheet,
but fails in visio 2003. I'm also need that the code works with visio XP
(2002).

A code to drive a visio drawing in excel is helpfull, because I think that
works with mathcad (mathcad can only handle vb script).

"In0" ... "In2", "Out0" are the names of circle shapes. Inputs and Outputs
are the variable names that mathcad get to the component.

Thanks in advance.

Code:

-----------------------------------------
Sub VisioObjEvent_Start()
Rem TODO: Add your code here
End Sub

Sub VisioObjEvent_Exec(Inputs,Outputs)

'define objects to manipulate
Set In0obj = Shapes.Item("In0")
Set In1obj = Shapes.Item("In1")
Set In2obj = Shapes.Item("In2")
Set Out0obj = Shapes.Item("Out0")

'get the input from Mathcad
In0 = Inputs(0).Value(0)
In1 = Inputs(0).Value(1)
In2 = Inputs(0).Value(2)

'update the input terminal text
In0obj.Text = CStr(In0)
In1obj.Text = CStr(In1)
In2obj.Text = CStr(In2)

'implement the logic in the drawing to change the text of
' the output terminal

Out0 = (In0 Xor In1) Xor In2

Out0obj.Text = CStr(Out0)


End Sub

Sub VisioObjEvent_Stop()
Rem TODO: Add your code here
End Sub
 
C

Chris Roth [Visio MVP]

A

Alvaro

Chris Roth said:
Hi Alvaro,

How are you getting the Visio object?

Is an embeded object, that can be manipulated with vb script.
Where is your "Shapes" object coming from?

Really, I don't know. Are only the names for the shapes. In earlies versions
of visio (4.2 for instance) attached code works.

Where is the error occurring?

Message says that needs a Shape Obj. Other trys, also, don't works, like
ActualPages.Shapes or combinations like this (this taken from the help for
visio)
It might also help to use object types, for example:

Dim InObj as Visio.Shape
Set In0obj = Shapes.Item("In0")

I try this, but don't work.
--
Hope this helps,

Chris Roth
Visio MVP

Thanks for your ans, Chris. Regards.

Alvaro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top