Programming some VBA to make some Position-Tricks for copy some Content

Started by skyerjoe, May 27, 2015, 09:00:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

skyerjoe

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


May some one has a idea which can solve my Problem


best regards John s.

Surrogate


AndyW

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
Live life with an open mind

Nikolay

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?

Yacine

Yacine