Vba 选择要在所有页面上搜索的图层

Vba 选择要在所有页面上搜索的图层,vba,coreldraw,Vba,Coreldraw,这是我正在使用的代码的一部分 Dim s As Shape Dim p As Page, numberPage As Integer Dim i& Dim WhatSamp As String WhatSamp = "Sample1" For i = 1 To ActiveDocument.Pages.Count ActiveDocument.Pages(i).Activate For Each s In ActiveDocument.ActivePage.Shapes If

这是我正在使用的代码的一部分

Dim s As Shape

Dim p As Page, numberPage As Integer
Dim i&

Dim WhatSamp As String

WhatSamp = "Sample1"

For i = 1 To ActiveDocument.Pages.Count
ActiveDocument.Pages(i).Activate

For Each s In ActiveDocument.ActivePage.Shapes

If s.Type = cdrTextShape Then

     If InStr(1, s.Text.Story, WhatSamp) > 0 Then
     ActivePage.Layers("Sample").Visible = True
     ActivePage.Layers("Sample").Printable = True

     End If

End If

Next

Next i
我使用的代码要长得多,但我相信这是相关的部分

它在页面上搜索我的文本(示例1),然后显示并使名为“示例”的图层可打印

我想,因为我有一个荒谬的数量需要层它需要永远运行

所以,我试图让它只在一个特定的层上搜索我的文本,这个层存在于每个页面上,叫做“样式”,但我似乎无法找到它

先谢谢你


让我知道是否需要更多信息来测试对象“的”使用层

然后


你所有的问题都很简单!!使用visual basic上的帮助进行Corel绘图或
 if S.Layer.Name="Style" then
If InStr(1, s.Text.Story, WhatSamp) > 0 Then
 ActivePage.Layers("Sample").Visible = True
 ActivePage.Layers("Sample").Printable = True