本文介绍了在Excel中打开visio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel工作表中创建了一个按钮,该按钮需要浏览并打开visio绘图。我尝试了两种方法,但无论哪种方式都有效。任何人都可以帮忙吗?


第一种方式:


Private Sub CommandButton1_Click()

Dim objVisio As Visio.Application

设置objVisio = New Visio.Application

objVisio.Visible = True

Dim vFile As Variant

vFile = objVisio.Documents.Open(" All Visio Files(* .vs *; * .v?x)")

如果vFile<>错误然后

Dim vsobj As Visio.Document

设置vsobj = objVisio.Documents.Add(vFile)

结束如果

结束子


第二种方式:


Private Sub button1_click()

Dim objVisio As Visio。应用

设置objVisio = New Visio.Application

objVisio.Visible = True

Dim uiObj As Visio.UIObject

设置uiObj = objVisio.BuiltInToolbars(0)

结束Sub

解决方案




有人帮助




您的第一种方式看起来几乎正确,但您想使用Excel的Application.GetOpenFileName而不是objVisio.Documents.Open。我没有Visio来测试它。如果你还有问题请回复:我今晚可以在家测试。 --Sam

I created a button in excel sheet, and that button need to browse and open a visio drawing. I try two ways to do it, but either way work. can anyone help?

First way:

Private Sub CommandButton1_Click()
Dim objVisio As Visio.Application
Set objVisio = New Visio.Application
objVisio.Visible = True
Dim vFile As Variant
vFile = objVisio.Documents.Open("All Visio Files (*.vs*; *.v?x)")
If vFile <> False Then
Dim vsobj As Visio.Document
Set vsobj = objVisio.Documents.Add(vFile)
End If
End Sub

Second way:

Private Sub button1_click()
Dim objVisio As Visio.Application
Set objVisio = New Visio.Application
objVisio.Visible = True
Dim uiObj As Visio.UIObject
Set uiObj = objVisio.BuiltInToolbars(0)
End Sub

解决方案


someone help


Your first way looks almost correct, but you want to use Excel''s Application.GetOpenFileName instead of objVisio.Documents.Open. I don''t have Visio here to test it. Reply back if you still have problems: I can test it at home tonight. --Sam


这篇关于在Excel中打开visio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 21:12