Need suggestions to draw in Visio with inputs from Excel

Asked By 10 points N/A Posted on -
qa-featured

Hi All,

I am having Microsoft Office 2013 installed in my laptop.

I have a requirement to develop code which creates Vision flow diagram with excel inputs. I have to use the organization chart of folder hierarchy using DIR and TREE commands. The diagram needs to show the files and folder hierarchy of a network drive. I have taken the data using DIR and TREE commands, but I don't know how to use this info in Visio.

Does anybody know any way to do this? Please help me on this one guys.

SHARE
Answered By 0 points N/A #191947

Need suggestions to draw in Visio with inputs from Excel

qa-featured

Hi,



You may try this!



Option Explicit



Sub VisioFromExcel()



    Dim AppVisio As Object

    Dim oCharacters As Object

    Dim lX As Long

    Dim sChar As String

    

    Set AppVisio = CreateObject("visio.application")

    AppVisio.Visible = True

    

    For lX = 1 To Cells(Rows.Count, 1).End(xlUp).Row

    

        AppVisio.Documents.AddEx "block_u.vst", 0, 0

        AppVisio.Windows.ItemEx(lX).Activate

        AppVisio.ActiveWindow.Page.Drop AppVisio.Documents.Item("BLOCK_U.VSS").Masters.ItemU("Box"), 1.35, 9.8

        AppVisio.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "20 pt"

        

        Set oCharacters = AppVisio.ActiveWindow.Page.Shapes.ItemFromID(1).Characters

        oCharacters.Begin = 0

        oCharacters.End = Len(oCharacters)

        sChar = Cells(lX, 1).Value

        oCharacters.Text = sChar



    

    Next

    

    Set oCharacters = Nothing

    Set AppVisio = Nothing

    

End Sub



Hope this works for you!



Regards,



Okello Kelvin

Related Questions