Insert multiple pictures in a stencil as shapes

Started by kiler40, March 27, 2013, 02:28:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kiler40

Hello Everybody.

I want to add lots of pictures in a stencil and every one of them to keep the file name (a catalog) so i can use them later as a call out shapes. So if i enter one of the pictures name in a field data of other shape to put the picture in the drawing.
Or to load picture with a file path. (C:\pictures\picture_name.jpg)
Is there a way to add them all in once ?

Yacine

Best is to record the operations in a macro and modify this macro then to your requirements.
I gave it a quick try and got all the necessary commands. hth and good luck, Y.
Yacine

kiler40

Ok, I got the idea.

But unfortunately i`m really not good in Macros.
How to change che macros to open next file ?
And how to copy file name as shape name...

Thanks in advance

Jumpy

Could you show what code you have so far? Maybe that helps to understand your intention.

A guess:
- You would need some kind of file dialog with multiselect, to select all the pictures you need
- For all those selected pictures you have to run your code

The pictures shall become shapes? Where - in drawing or in stencil?
The shapename shall be the Path+Name of the picture? Wouldn't it be better to store that in a user defined cell?

kiler40

I`ll try the utility. But firs need to speak with my IT department, because i don`t have correct rights Thanks.

And here is the code so far

Sub Macro4()

    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Import")
    Application.ActiveWindow.Page.Import "C:\Documents and Settings\andrei.kotelnikov\Desktop\connectors-contact\71191147.jpg"
    Application.EndUndoScope UndoScopeID1, True

    Dim UndoScopeID4 As Long
    UndoScopeID4 = Application.BeginUndoScope("Drop On Stencil")
    ActiveWindow.DeselectAll
    ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemFromID(1), visSelect
    Dim vsoSelection1 As Visio.Selection
    Set vsoSelection1 = ActiveWindow.Selection
    Dim vsoDoc1 As Visio.Document
    Set vsoDoc1 = Application.Documents.Item("Stencil1")
    vsoDoc1.Drop vsoSelection1, 0#, 0#
    vsoSelection1.Delete
    Application.EndUndoScope UndoScopeID4, True

    Dim UndoScopeID5 As Long
    UndoScopeID5 = Application.BeginUndoScope("Master Properties")
    Dim vsoMaster1 As Visio.Master
    Set vsoMaster1 = Application.Documents.Item("Stencil1").Masters.ItemU("Master.0")
    vsoMaster1.Name = "71191147"
    Application.EndUndoScope UndoScopeID5, True

End Sub

kiler40

Dmitry`s Utility worked more than perfectly for my needs.

THANK YOU ! :)