Visio Guy

Visio Discussions => Programming & Code => Topic started by: skyerjoe on May 27, 2015, 09:00:39 AM

Title: Programming some VBA to make some Position-Tricks for copy some Content
Post by: skyerjoe on May 27, 2015, 09:00:39 AM
Hello guys

I've posted already something in the General Visio Section.

But we have found out, that these Feature which i'd like to have isn't possible but may unless with a bit of VBA.

So here is the post: http://visguy.com/vgforum/index.php?topic=6508.msg26983#msg26983
(http://visguy.com/vgforum/index.php?topic=6508.msg26983#msg26983)

May some one has a idea which can solve my Problem


best regards John s.
Title: Re: Programming some VBA to make some Position-Tricks for copy some Content
Post by: Surrogate on May 27, 2015, 09:10:28 AM
Are you sure that you need do this in visio ?  ::)
Title: Re: Programming some VBA to make some Position-Tricks for copy some Content
Post by: AndyW on May 27, 2015, 09:37:37 AM
You could do something like this, where if you drop a shape over a shape in the background page it creates a new page, cuts and pastes the dropped shape onto the new page. In this case I am checking if the pin position is in a shape on the background, but maybe will give you some hints at things you could try.

Private Sub Document_ShapeAdded(ByVal vsoShape As IVShape)

    Dim dblX As Double
    Dim dblY As Double
    Dim vsoBackPage As Visio.Page
    Dim vsoSelection As Visio.Selection
    Dim vsoNewPage As Visio.Page
   
    With vsoShape
   
        dblX = .CellsSRC(visSectionObject, visRowXFormOut, visXFormPinX).ResultIU
        dblY = .CellsSRC(visSectionObject, visRowXFormOut, visXFormPinY).ResultIU
   
        Set vsoBackPage = .ContainingPage.BackPage
       
    End With
   
    Set vsoSelection = vsoBackPage.SpatialSearch( _
                                            dblX, _
                                            dblY, _
                                            visSpatialContainedIn, _
                                            0, _
                                            visSpatialFrontToBack + visSpatialIncludeHidden)
   
    If vsoSelection.Count > 0 Then
   
        Set vsoNewPage = ThisDocument.Pages.Add
       
        Call vsoShape.Cut
       
        Visio.ActiveWindow.Page = vsoNewPage.NameU
       
        Call vsoNewPage.Paste
       
    End If
   
End Sub
Title: Re: Programming some VBA to make some Position-Tricks for copy some Content
Post by: Nikolay on May 27, 2015, 10:40:54 AM
I think the main point is, you do not want to use Visio pages, but to have everything on a single page (which is auto-split to multiple pages on printing)
Although this makes sense, it's not how it works in Visio...

Do I understand correctly that you request is this one: Model everything on a single Visio sheet (no page switching), but include "logo" picture in each printed page header/footer, and exclude the header/footer area from "working area" so that shapes land "properly" on drop?
Title: Re: Programming some VBA to make some Position-Tricks for copy some Content
Post by: Yacine on May 27, 2015, 05:06:26 PM
Have a look at my answer in your other post.