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

问题描述

我并不是很愿意这样说.我试图打开Visio(正在运行),然后在我选择的文档中打开一个页面.谢谢

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.

推荐答案

尝试:

VsApp.ActiveWindow.Page = vsPage

如果这不起作用,请尝试:

If that doesn't work, try:

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

这篇关于在Visio中选择活动页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 20:25