Excel automation: how to make the cable of a macro inserted in a synoptic folio directly associate with that of the macro inserted in the schematic folio

I need to insert:

  1. a macro, consisting of a terminal block, a cable (associated with a harness) and equipment in a folio diagram,
  2. another macro consisting of the same terminal block, the same cable (associated with the same harness) and the same equipment in a synoptic folio

In the respective macros I put variables on the names of equipment, cables, harnesses, terminal blocks, terminals.

Automation Result:

  1. The synoptic terminal block is associated with the schematic terminal block
  2. The synoptic equipment is associated with the schematic equipment
  3. In the folio diagram, the cable is correctly inserted with its harness.
  4. In the synoptic folio, SOLIDWORKS creates another harness (same name and void) and another cable (same name and without harness) which, as a result, is not associated with the cable in the diagram

How do I get the macro of the synoptic to associate with the macro of the diagram?

Thank you for your answers

No matter how much I reread your message several times, I don't really understand.

For me, a macro is a VBA code. So what do you mean by "a macro, composed of a terminal block"?

Also, the use of the verb "associate" is rather vague. As well as "insert"

It would help if you could give us a copy of the code. What if macros 1 and 2 are in Excel or Solidworks.

And some screenshots, which show the different steps of the current process and the desired outcome, could also be helpful.

Hello Jérôme,

The macros are in SOLIDWORKS (created automatically, I don't know where to find the code). The procedure is indicated in the "Excel Automation" help

Macro 1 (1 terminal block, 1 cable, and 1 device) in a Folio Schematic

macro 2 (1 terminal block, 1 cable and 1 piece of equipment) in a synoptic folio

In the automation Excel file, I put the same names on the cables, equipment, terminal blocks, wire number, terminals...

Results:

The Synoptic terminal block is assigned to the schematic terminal block, the Schematic equipment is assigned to the Schematic Equipment, the Schematic macro cable is not assigned to the Schematic macro cable, SOLIDWORKS creates 2 different cables.


automation_162tle_light.xlsx

   

the terminal block, the terminals and the equipment are good, but Solidworks creates 2 different cables

The attached Excel file does not contain any useful information , e̶t̶ ̶s̶a̶n̶s̶ ̶l̶e̶ ̶c̶o̶d̶e̶ ̶d̶e̶s̶ ̶m̶a̶c̶r̶o̶s̶ ̶o̶n̶ ̶n̶e̶ ̶v̶a̶ ̶p̶a̶s̶ ̶p̶o̶u̶v̶o̶i̶r̶ ̶t̶'̶a̶i̶d̶d̶e̶r̶. ̶ ̶ ̶P̶o̶u̶r̶ ̶t̶r̶o̶u̶v̶e̶r̶ ̶l̶e̶ ̶c̶o̶d̶e̶ ̶d̶e̶s̶ ̶m̶a̶c̶r̶o̶s̶ ̶d̶a̶n̶s̶ ̶S̶o̶l̶i̶d̶w̶o̶r̶k̶s̶: ̶ ̶C̶h̶e̶r̶c̶h̶e̶ ̶l̶e̶s̶ ̶f̶i̶c̶h̶i̶e̶r̶ ̶a̶v̶e̶c̶ ̶l̶'̶e̶x̶t̶e̶n̶s̶i̶o̶n̶ ̶s̶w̶p̶ ̶s̶u̶r̶ ̶t̶o̶n̶ ̶P̶C̶, ̶ ̶p̶u̶i̶s̶ ̶o̶u̶v̶r̶e̶ ̶l̶e̶s̶ ̶e̶n̶ ̶f̶a̶i̶s̶a̶n̶t̶ ̶a̶p̶p̶a̶r̶â̶î̶t̶r̶e̶ ̶l̶e̶ ̶m̶e̶n̶u̶ ̶m̶a̶c̶r̶o̶ ̶e̶t̶ ̶c̶l̶i̶q̶u̶e̶ ̶s̶u̶r̶ ̶"̶É̶d̶i̶t̶e̶r̶"̶.̶ ̶V̶o̶i̶r̶ ̶i̶c̶i̶ ̶e̶t̶ ̶i̶c̶i̶ ̶p̶o̶u̶r̶ ̶p̶l̶u̶s̶ ̶d̶'̶i̶n̶f̶o̶

So much for me. I just read that a macro in Solidworks Electrical is not VBA code like in Solidworks.

Each time SOLIDWORKS adds floors to the terminals to wire a new cable

Ok, that's why I couldn't find anything anywhere. So how do you make sure that SOLIDWORKS ELECTRICAL doesn't create a new floor on the terminals?

PROGRESS: I have associated a manufacturer reference to the terminals of each macro + variable on the number of the terminals + identical location via "detailed wiring" = same cable on the synoptic and on the diagram.

UNFORTUNATELY, there is always another cable associated with nothing in another harness.