I am looking in vain for a solution to link the name of my drawing sheet to an existing personal property.
I tried in vain to call it in the name of the sheet with the $PRPSHEET: " REFERENCE " but it doesn't seem to work.
I know that I would succeed in doing it via a macro but if I can do this directly in my MEP template it would avoid additional manipulations in the MEP.
Hello, I don't think it's possible directly... While waiting for another answer, here's a macro to start with: (Gleaned from the Solidworks forum)
' Written by: Deepak Gupta (http://gupta9665.wordpress.com/)
' ------------------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.ModelDoc2
Dim swSheet As SldWorks.Sheet
Dim swModelview2 As Configuration
Dim ConfigName As String
Dim vSheets As Variant
Dim swView As SldWorks.View
Dim ConfigProperty As String
Dim i As Integer
Sub main()
Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
' Is a drawing document active?
If swDraw Is Nothing Then
swApp.SendMsgToUser2 "A drawing document must be open and the active document.", swMbWarning, swMbOk
Exit Sub
End If
' Is it a drawing document?
If swDraw.GetType <> SwConst.swDocDRAWING Then
swApp.SendMsgToUser2 "A drawing document must be open and the active document.", swMbWarning, swMbOk
Exit Sub
End If
vSheets = swDraw.GetSheetNames
For i = 1 To swDraw.GetSheetCount
swDraw.ActivateSheet vSheets(i - 1)
Set swSheet = swDraw.GetCurrentSheet
Set swView = swDraw.GetFirstView
Set swView = swView.GetNextView
Set swModel = swView.ReferencedDocument
ConfigName = swView.ReferencedConfiguration
' Replace Kod with the required configuration property.
ConfigProperty = swModel.CustomInfo2(ConfigName, "Kod")
swSheet.SetName ConfigProperty
Next i
Set swModel = Nothing
swDraw.EditRebuild3
swDraw.Save2 False
End Sub