Re: Exporting length of connectors to Excel



John,

adding a User cell to the connector Masters, ...could you be more specific
about this? What will I achieve by this and ...I am sure you have a code
snippet for such action up your sleeve again...? :-)

Mac

"John Goldsmith" wrote:

Hello Mac,

Here's some code to produce a csv (saved in the same location and name) file
that you could open in Excel:

Sub Report1dLengths()
'Requires reference to
'Microsoft Scripting Runtime (see Tools/References
'in the VBE
Dim pag As Page
Dim shp As Shape
Dim sLayers As String
Dim fso As FileSystemObject
Dim ts As TextStream
Dim sFileName As String

sFileName = ThisDocument.Path & Replace(ThisDocument.Name, ".vsd", ".csv")
Set fso = New FileSystemObject
Set ts = fso.CreateTextFile(sFileName, True)
ts.WriteLine "Page Name,Shape ID,Assigned to layers:,Shape Length (inches)"

For Each pag In ThisDocument.Pages
For Each shp In pag.Shapes
If shp.OneD = True And shp.Type = visTypeShape Then
For i = 1 To shp.LayerCount
sLayers = sLayers & shp.Layer(i).Name & ";"
Next i
ts.WriteLine pag.Name & "," & shp.ID & "," & sLayers & "," &
shp.LengthIU
sLayers = ""
End If
Next shp
Next pag
ts.Close
End Sub

If this is functionality you need a lot then you might find it easier to
write some code to add a User cell to the connector Masters that could then
be reported by Visio's own reporting tools (see Data / Reports... menu).

Anyway, hopefully this will point you in the write direction.

Best regards

John


John Goldsmith
www.visualSignals.co.uk

"Mac" <Mac@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:81D2E7D1-9E0C-4994-8661-9A9CEBB071DA@xxxxxxxxxxxxxxxx
Hello,
I have several layers packed with objects and connectors linking these
together. I need to extract the length ( was told that it's stored in the
LengthUI var) of each connector on a specific layer and save it to a list,
preferrably an Excel ***. Is there any ( similar at least) sample code
for
me to see how to achieve this? Or someone willing to take their time and
share their ideas? Thanks in advance!
Mac



.


Loading