Make stencils invisible?

D

damion

I've written a sub which I thought would toggle the visibility of the
stencils, but it doesn't work. If anyone could shed some light on why it
doesn't work the way I thought it would, I'd be most appreciative.

here's the code...

Public Sub HideStencilsForDocument(objWindow As Visio.Window, bHideIt As
Boolean)
Dim w As Window, wsub As Window
Dim i As Integer
Dim Count As Integer
Dim objWindows As Visio.Windows
Dim StencilCount As Integer

Set objWindows = objWindow.Windows
Count = objWindows.Count
i = 1
While Count >= i
Set wsub = objWindows(i)
If wsub.Type = visDockedStencilBuiltIn Then
If bHideIt Then
wsub.Visible = False
Else
wsub.Visible = True
End If
i = i + 1
Else
i = i + 1
End If
Wend

end sub
 
J

John

Hi Damion,

I've had a go with this a few times and it's worked for me. I set objWindow
to Application.ActiveWindow and bHideIt to True. Does this work for you?
Are you being passed the right window in objWindow and boolean value in
bHideIt?

The other thing is to check that the stencils you're refering to are type 7
(visDockedStencilBuiltIn). Add in a "Debug.Print wsub.Type" statement in
your Count loop to check you're getting the right type.

Hope that helps

Best regards

John

I've tried this and it works fine for me
 
J

JuneTheSecond

It seems it depends on how to call sub.
You would be care to choose the first argument, for example:
HideStencilsForDocument ActiveWindow, False ,
or
HideStencilsForDocument Application.Windows(1), False .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top