Display value of custom property Solidworks VBA Macro -
i want create macro exports drawing pdf, in format: drawing name + title + date.
i created macro want when enter value title. in project want title equal part name. therefore use code title value:
$prpsheet:"sw-file name(file name)"
the drawing sheet displays title fine. macro not work. macro not convert code part name. cannot figure out why. tips?
this how title:
dim swcustprop custompropertymanager function formatfilelocation() string dim title string dim bool boolean dim val string bool = swcustprop.get4("title", true, val, title) 'title name of 'property , has value: $prpsheet:"sw-file name(file name)" end function edit: tried using both title , val, both give same faulty result.
if using solidworks 2014 or later, should use swcustprop.get5(). get4() obsolete per documentation.
this code worked me:
dim swapp object dim swcustprop custompropertymanager dim mde modeldocextension dim swmodel modeldoc2 sub main() set swapp = application.sldworks set swmodel = swapp.activedoc set mde = swmodel.extension set swcustprop = mde.custompropertymanager("") call formatfilelocation end sub function formatfilelocation() dim title string dim bool boolean dim val string dim resolved boolean bool = swcustprop.get5("title", true, val, title, resolved) 'title name of 'property , has value: $prpsheet:"sw-file name(file name)" end function here drawing custom properties:

Comments
Post a Comment