Choose active page in Visio

怎甘沉沦 提交于 2020-06-29 02:43:05

问题


Edited: I didn't phrase this very will.. I am trying to open Visio (working) and then open a page in the document of my choosing. Thanks

Dim FName As String
Dim VsApp As Object

On Error Resume Next
Set VsApp = GetObject(, "Visio.Application")
If VsApp Is Nothing Then
Set VsApp = CreateObject("Visio.Application")
If VsApp Is Nothing Then
MsgBox "Can't connect to Visio"
Exit Sub
End If
End If
On Error GoTo 0

FName = "C:\myfile.vsd"

If Not Intersect(Target, Range("c2")) Is Nothing Then
VsApp.Documents.Open FName
VsAppPage = "mypage"
Cancel = True
ElseIf Not Intersect(Target, Range("c4")) Is Nothing Then
VsApp.Documents.Open FName
vsPage = "mypage2"
VsApp.ActivePage = vsPage
Cancel = True
End if

But this is code it trying to rename the active page. I would like it to select the page name in quotes.


回答1:


Try:

VsApp.ActiveWindow.Page = vsPage

If that doesn't work, try:

VsApp.ActiveWindow.Page = VsApp.Documents.Open(FName).Pages(vsPage)


来源:https://stackoverflow.com/questions/30646937/choose-active-page-in-visio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!