I have used the below code in solidworks macro to override the dimension and its working fine, when I used same code in excel vba I am getting errors. Anyone please help me on this.
Code which I used,
Dim swApp as SldWorks.SldWorks
Dim Part as ModelDoc2
Dim SelMgr as SelectionMgr
Dim DispDim as DisplayDimension
Dim theVal as Double
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
boolstatus = Part.Extension.SelectByID2("D1@Sketch1@Part1@Drawing View2","DIMENSION",0,0,0, FALSE,0, Nothing,0)
Set DispDim = SelMgr.GetSelectedObject6(1,0)
theVal = (50 * 25.4) / 1000
DispDim.SetOverride True, theVal
End Sub
API
Macro