Macro for adding PDM DataCard details in batch

Goal

I want to fill PDM datacard details for solidworks assembly & drawing file in batch.

Environment

  • SOLIDWORKS version: 2026
  • API surface: PDM API
  • Language and runtime: VBA
  • macro

Current Code

// paste the small Set AEdmVar = AEdmFile.GetEnumeratorVariable
    AEdmVar.SetVar "ERN Number", "@", ERNNumber ' "@" applies to file-level custom properties
    AEdmVar.SetVar "Description 1", "@", Description1
    AEdmVar.SetVar "Description 2", "@", Description2
    AEdmVar.SetVar "Description 3", "@", Description3
    'AEdmVar.SetVar "Description Full", "@", Description
    AEdmVar.SetVar "Series Code", "", Series
    AEdmVar.SetVar "Size Code", "", Size
    AEdmVar.SetVar "Base Number", "", Base
    AEdmVar.SetVar "Material Code", "", Material
    AEdmVar.SetVar "Material Specification", "", Materialspec
    AEdmVar.SetVar "Flange Drilling", "", Endcon
    AEdmVar.SetVar "GAWeight", "", Weight
    AEdmVar.SetVar "Pressure Rating", "", PrRating
    AEdmVar.SetVar "Company", "", Company
    AEdmVar.SetVar "Document Type", "", DocType
    AEdmVar.SetVar "Company Location", "", Location
    AEdmVar.SetVar "File Number", "", Filename
    AEdmVar.Flush
    AEdmVar.CloseFile True
est reproducible sample here

Actual Behavior

in assembly there are 2 configuration. Open & Close. in datacard, 3 config, @, Open & Close. & in Solidworks custom properties. Description full is $PRP:“Description1”, $PRP:“Description2”, $PRP:“Description3”. when i run macro, in solidworks properties Description 1 & 2’s Evaluated value is correct. but full description i am getting just “, ,”. some times it will sow full description for me. but in other system it will be blank. Some time for me it showed details but next day when state wasw changed, it become blank.

Also this is happening to only some files. some are fine.

Expected Behavior

Should show full description.

What I Tried

 AEdmVar.SetVar "Description 3", "", Description3
    AEdmVar.SetVar "Description Full", "", Description
    AEdmVar.SetVar "Series Code", "", Series

To set your custom properties, you should not use "" for the configuration name for Parts/Assemblies, but "@". Furthermore, you use don't need to use Flush when you use CloseFile(true). The true flushes automatically. By the way, have you considered using the IEdmBatchUpdate2 Interface? https://help.solidworks.com/2026/english/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmBatchUpdate2.html?id=4.6.1.35

–