how can I create a shape next to other?

Started by Miguel, March 29, 2017, 07:15:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Miguel

Hello everybody!

I would like to know how can I create a shape next to other.
For example, I have a rectangle in my page. How can I create a square next to the Rectangle?

Thank you for your help! I'm a beginner  :-[

Surrogate

#1
Hello, amigo !
Hope that my regular mute video can help :)

Miguel

Hi my friend!

Thank you for your answer! But it does not answer my question  :-\
I will try to be more precise ahah.

I have already a shape on my page. Now, I want to add an other shape in my page. With a macro I would like to postion my new shape with respect to the postion of the shape on my page.
For example, I have already a rectangle in my page. I would like (thanks to a macro), take a square from my stencil and put next to the rectangle. But it's very important to do this with a macro.

I hope that you can understand my little problem.

Thanks  :D ;D

Surrogate

Hi ! Sorry, i did't see that topic in Programming & Code thread  :(

Sub ForMiguel()
' This code originally posted in message
' http://visguy.com/vgforum/index.php?topic=7801.msg33295#msg33295
Dim i As Integer, N As Integer
Dim sh As Shape ' exist shape
Dim shn As Shape ' new shape
Dim sc As Section
If ActiveWindow.Selection.Count = 0 Then MsgBox "Select target shape!": Exit Sub
Set sh = ActiveWindow.Selection.PrimaryItem
Dim px As Single, py As Single, sw As Single
px = sh.Cells("PinX") ' get shape'sPinX coordinates
py = sh.Cells("PinY") ' get shape's PinY coordinates
sw = sh.Cells("Width") ' get shape's width
N = InputBox("How many new copies of shapes you want?")
For i = 1 To N
pxn = px + sw
Set shn = sh.Duplicate
shn.Cells("PinX").Formula = pxn
shn.Cells("PinY").Formula = py
Set sh = shn
px = pxn
Next
End Sub


Miguel

Yeah, thank you!

I will try it and work with it. If I have any problem I will tell you  ;) ;) ;D ;D

wapperdude

Visio 2019 Pro