Connector Macro Help

J

joey_costanza

Hello Everyone,
I am very stuck and I was wondering if any of you could give me a
hand. I'm trying to write a Perl or VB script to connect some
rectangles in Visio with a 'connector'. I have found there is very
little help online in the way of making Visio macros with Perl. I have
found Perl can translate directly in to Visual Basic in most cases by
substituting "->" in for ".". For some reason, however, I am not able
to say

$Visio->ActivePage->Drop($Visio->ConnectorToolDataObject, 2, 2);
where $Visio is the Visio Application. I am using the Win32::OLE
library by the way.

Fortunatly, I am able to connect the shapes with the connector by
having it select the two rectangles and using

$Visio->ActiveWindow->Select($square1, 2);
$Visio->ActiveWindow->Select($square2, 2);
$Visio->ActiveWindow->Selection->ConnectShapes;

Anyway...my main goal is to change the color of the connector. Is
there anyway to do this by way of the method I am using. I think I
need to set the connector it created equal to a variable somehow, that
way I can use the $connector->cells("LineColor")->{Formula} = color. I
am not currently sure how to define it. I was hoping one of you would
know some clever way to do it. If you know how to do this in VB,
without using the Drop way I would REALLY appriciate it, and hopefully
I will be able to translate it to Perl. I've been going around in
circles about this for days. If you know how to use the Drop way I
talked about above in Perl, first, you are awesome, second can you
please tell me how?

If you know the answer to this, seriously you are a genious.
Thanks,
Joe
 
P

Paul Herber

Hello Everyone,
I am very stuck and I was wondering if any of you could give me a
hand. I'm trying to write a Perl or VB script to connect some
rectangles in Visio with a 'connector'. I have found there is very
little help online in the way of making Visio macros with Perl. I have
found Perl can translate directly in to Visual Basic in most cases by
substituting "->" in for ".". For some reason, however, I am not able
to say

$Visio->ActivePage->Drop($Visio->ConnectorToolDataObject, 2, 2);
where $Visio is the Visio Application. I am using the Win32::OLE
library by the way.

Fortunatly, I am able to connect the shapes with the connector by
having it select the two rectangles and using

$Visio->ActiveWindow->Select($square1, 2);
$Visio->ActiveWindow->Select($square2, 2);
$Visio->ActiveWindow->Selection->ConnectShapes;

The ConnectShapes method will return an object, the shape object of
your new connector. This will be your $connector.
(I haven't tried or checked this.)
Anyway...my main goal is to change the color of the connector. Is
there anyway to do this by way of the method I am using. I think I
need to set the connector it created equal to a variable somehow, that
way I can use the $connector->cells("LineColor")->{Formula} = color.

use an RGB(r,g,b) string for your colour.
 
J

joey_costanza

The ConnectShapes method will return an object, the shape object of
your new connector. This will be your $connector.
(I haven't tried or checked this.)


use an RGB(r,g,b) string for your colour.

Thanks for the quick reply Paul, but according to the VB help (and
many trials and failures on my part) the ConnectShapes method doesn't
return anything. Do you know of another way I could make a variable
equal to the connector that is created?
Thanks,
Joe
 
P

Paul Herber

Thanks for the quick reply Paul, but according to the VB help (and
many trials and failures on my part) the ConnectShapes method doesn't
return anything. Do you know of another way I could make a variable
equal to the connector that is created?

Well, you might be better off using the Drop method with a suitable
connector master. The Visio SDK has examples of this. The Drop method
certainly returns a shape object.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top