如何在已创建的 Visio 绘图中使用 vba 选择形状
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18236300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to select shapes using vba in an already created Visio drawing
提问by JahKnows
I have a Visio drawing and I want to be able to Select shapes from it and paste them to other sheets depending on certain variables.
我有一张 Visio 绘图,我希望能够从中选择形状并根据某些变量将它们粘贴到其他工作表中。
What is the code for selecting the different shapes on the page. I am trying this but it is not working.
在页面上选择不同形状的代码是什么。我正在尝试这个,但它不起作用。
Dim vsoSelection As Visio.Selection
vsoSelection.Select Visio.Shape(1), visSelect
What am I missing here?
我在这里缺少什么?
and also is it possible to get the strings entered into text boxes into Visio?
以及是否可以将输入到文本框中的字符串输入 Visio?
回答by Jon Fournier
I am assuming you're getting an error because your vsoSelection object is nothing. So you need to do: Set vsoSelection = ActiveWindow.Selection
我假设您收到错误,因为您的 vsoSelection 对象什么都不是。所以你需要这样做:设置 vsoSelection = ActiveWindow.Selection