페이지

2011년 2월 20일 일요일

Visio 2007 Programming: Change stencil title

Imports Microsoft.Office.Interop.Visio
Public Class ThisAddIn
Private vsoDoc As Visio.Document
Private Sub ThisAddIn_Startup(ByVal sender As Object, _
ByVal e As System.EventArgs ) _
Handles Me.Startup
vsoDoc = Application.Documents.Add("")
vsoDoc = Application.Documents.OpenEx("Basic Shapes.vss", _
VisOpenSaveArgs.visOpenDocked + VisOpenSaveArgs.visOpenCopy)
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Shutdown

End Sub
End Class

Above code creates a blank document with docked basic shape stencil. However, the title of stencil window is "Stencil 2" and the number is constantly changing whenever a new document is created. So, How do I set the title with a meaningful name?

To solve this problem, add following statement after a document is created or opened.

vsoDoc.Title = "Basic Shapes"

댓글 없음: