Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
499 views
in Technique[技术] by (71.8m points)

vba - Is there any method to change shape properties of visio diagram from excel macro

Sub MAIN()
Call OpenVisioDoc
End Sub

Function OpenVisioDoc()

Dim FName As String
Dim VisioApp As Object

On Error Resume Next
Set VisioApp = GetObject(, "Visio.Application")
If VisioApp Is Nothing Then
Set VisioApp = CreateObject("Visio.Application")
If VisioApp Is Nothing Then
MsgBox "Can't connect to Visio"
Exit Sub
End If
End If
On Error GoTo 0
vsoStrng = Worksheets("Generation").Range("C" & 3).Value
FName = vsoStrng

VisioApp.Documents.Open FName '
VisioApp.Visible = True
End Function
Sub ShapeControl()
Dim shp As Shape
Dim mst As Master
Dim Verdana_ID As Integer

Verdana_ID = ActiveDocument.Fonts.Item("Verdana").ID

' iterate all shapes per page
For Each shp In ActivePage.Shapes
    ' declare parent master for current shape
    Set mst = shp.Master
    ' Process only shapes that have parent master-shape
    If Not (mst Is Nothing) Then
    ' Connector Properties Settings
    If mst.Name = "Dynamic connector" Then shp.Cells("LineColor").Formula = "RGB(255,255,0)": shp.Cells("LineWeight").Formula = "1.0 pt"
    ' Process Box Properties Settings
    If mst.Name = "Process" Then shp.Cells("Width").Formula = "1.5": shp.Cells("Height").Formula = "2.0 ": shp.Characters.CharProps(visCharacterSize) = 12
    End If
Next
End Sub

The above code is not working can anyone help

question from:https://stackoverflow.com/questions/65839966/is-there-any-method-to-change-shape-properties-of-visio-diagram-from-excel-macro

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...