PDA

View Full Version : [SOLVED:] How to add reference to external library?



Scrooge
02-01-2019, 07:49 PM
Hello everyone,
I am a circuit designer using Cadence OrCAD Capture as tool, I am now trying to code a VBA script to automatically assign pins and nets according to a Excel file.
The script is set to be running in OrCAD but not Excel.
The intrinsic VBA compiler of OrCAD does not have a reference configurator and the reference must be added via codes.
"ThisWorkbook.VBProject.References." does not work in OrCAD Capture, I need some other method to cover this need.

The screenshot below is the result of running without reading XLS file:
23691



SUB TestMacro
'MACROMENU Set TestMacro Properties
'MACROKEY C
'MACRODESCRIPTION ****


path=InputBox("You are ****ed.","****ed path","E:\XM_EE.olb")
part=InputBox("You are ****ed.","****ed part","J_ASE6H4010")
desi=InputBox("You are ****ed.","****ed designator","")
PlacePart 0, 0, path, part, desi, FALSE


PlaceWire -0.3, 0.3, -0.8, 0.3
PlaceNetAlias 0, 0, "GPIO_****ed"


For i=0 To 10 Step 1
PlaceWire 0.5, 0.1, 0, 0.1
PlaceNetAlias 0, 0, "GPIO_****ed"
Next


END SUB


If anyone can solve my problem, I would be very appreciate, Thx!:)

macropod
02-01-2019, 08:08 PM
Have you tried using late binding with GetObject/CreateObject?

Scrooge
02-01-2019, 08:20 PM
Ahhh! Thx for enlighting me!:thumb:yes