-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmod_vsd_ExportInfoToExcel.bas
72 lines (62 loc) · 2.22 KB
/
mod_vsd_ExportInfoToExcel.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Attribute VB_Name = "mod_vsd_ExportLinkInfoToExcel"
' mod_vsd_ExportLinkInfoToExcel
' 150414.AMG allow trial run for hyperlink update tests
' 150413.AMG ignore empty hyperlinks (descr and url blank)
' 150316.AMG added headers and better descriptive columns
' 150303.AMG created
' depends on:
' mod_vsd_ShapesLinks
Option Explicit
Public strCurrentFileFolder As String
Public strCurrentFileNameOnly As String
Public bTrialRun As Boolean
Public Sub OutputLinkDetailsToWorksheet()
bTrialRun = True
Dim strFileNames() As String
strFileNames() = arrFilteredPathnamesInUserTree(strFilter:=".vsd", bRecurse:=True)
' func to return the number of elements without error (0 if none)
If strFileNames(0) <> "" Then
PrepareListWithHeaders
Dim ifile As Integer
For ifile = 0 To UBound(strFileNames)
strCurrentFileFolder = GetFolderFromFileName(strFileNames(ifile))
strCurrentFileNameOnly = JustFileName(strFileNames(ifile))
AddDiagramToList
VisioOpenAndRecurseAllShapesInDoc strFileNames(ifile), Not (bTrialRun)
Next
ExcelOutputShow
End If
End Sub
Function PrepareListWithHeaders()
ExcelOutputCreateWorksheet
ExcelOutputWriteValue "DiagramFolder"
ExcelOutputWriteValue "DiagramFilename"
ExcelOutputWriteValue "ShapeName"
ExcelOutputWriteValue "ShapeText"
ExcelOutputWriteValue "HyperlinkText"
ExcelOutputWriteValue "CurrentURL"
ExcelOutputWriteValue "NewURL"
ExcelOutputNextRow
End Function
Function AddDiagramToList()
ExcelOutputWriteValue strCurrentFileFolder
ExcelOutputWriteValue strCurrentFileNameOnly
ExcelOutputWriteValue ""
ExcelOutputNextRow
End Function
Function AddHyperlinkDetailToList( _
hlk As Hyperlink _
, Optional strNewAdress As String = "" _
)
' ignore empty hyperlinks
If hlk.Description & hlk.Address <> "" Then
ExcelOutputWriteValue strCurrentFileFolder
ExcelOutputWriteValue strCurrentFileNameOnly
ExcelOutputWriteValue hlk.Shape.Name
ExcelOutputWriteValue hlk.Shape.Text
ExcelOutputWriteValue hlk.Description
ExcelOutputWriteValue hlk.Address
ExcelOutputWriteValue strNewAdress
ExcelOutputNextRow
End If
End Function