PDA

Click to See Complete Forum and Search --> : Visio Drawing Control, Stencils


gunslingor
Dec 22nd, 2008, 03:50 PM
The below code works fine except that the stencils are editable and every time I close the form I get the message, "would you like to save stencil 1". Open and close the form again it says "would you like to save stencil 2" and so on.Private Sub AutoAddMenus()

'DrawingControl0.vsoapp.StencilPaths = DrawingControl0.vsoapp.StencilPaths & ";" & Stencil_Path

Dim vsoWin As Visio.Window
Set vsoWin = DrawingControl0.Window

Dim vsoWins As Visio.Windows
Set vsoWins = DrawingControl0.Window.Application.Windows

Dim vsoDoc As Visio.Document
Set vsoDoc = DrawingControl0.Document

Dim vsoDocs As Visio.Documents
Set vsoDocs = DrawingControl0.Window.Application.Documents

Dim vsoApp As Visio.Application
Set vsoApp = DrawingControl0.Window.Application

Dim vsoStencilWindow As Visio.Window

Dim vsoTVAstencil As Visio.Document

Dim Path As String
Dim Stencil1_Name As String
Dim Stencil_Path As String
Path = CurrentProject.Path()
Stencil1_Name = "TVA Cyber Network.vss"
Stencil_Path = Path & "\Visio Stencils\" & Stencil1_Name

'add the standard TVA stencil to documents collection
'Set vsoStencilWindow = vsoApp.Window
'vsoStencilWindow.AllowEditing = False
'Set vsoStencilWindow = vsoTVAstencil.OpenStencilWindow
Set vsoTVAstencil = vsoDocs.Add(Stencil_Path)
vsoTVAstencil.Title = "TVA Standard"

'Open the Document Stencil window.
'Set vsoStencilWindow = vsoWins.Add()
'vsoStencilWindow.AllowEditing = False

End Sub

Hack
Dec 23rd, 2008, 06:52 AM
I've never done anything with Visio, but if this were happening to me in Word or Excel, I would set DisplayAlerts = False

Does Visio have an equivalent to that?

(BTW: I edited your post and added your code goes here tags as it makes reading posted code a lot easier. :) )

gunslingor
Dec 23rd, 2008, 06:56 AM
Not exactly, but similar. The code currently opens the stencils to a docked window. I do this simply by added the stencils "document" object to the docs list. I think I can use a property called allowediting=false, but this property only applies to "window" objects, not "document" objects. So how do I define the window for the docked stencils?