Assembly creation via excel

Hello everyone,

I'm still in my overall management by excel I'm getting to the goal I still have a question 

I am looking for how to open an empty asm (new file) and be able to integrate an existing asm inside, can you help me?

Basically, when I click on my button in excel, I open a new empty ASM and the macro inserts an already created asm in asm new

I made this code but I can't insert my asm

 

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long



Private Sub CommandButton1_Click()


Set swApp = CreateObject("SldWorks.application") '_
Set Part = swApp.ActiveDoc

Set Part = swApp.NewDocument("C:\ProgramData\SolidWorks\SOLIDWORKS 2015\templates\Assemblage.asmdot", 0, 0, 0)
swApp.ActivateDoc2 "Assemblage1", False, longstatus
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView


boolstatus = Part.AddComponent("C:\Users\HOME-TOUR\Desktop\Modele_630 (1)\35xxxD00.SLDASM", -1.53010157955435E-03, -0.111697415307456, 3.05344061179997)

End Sub

 

I can't find where it gets stuck

 

Hello

The AddComponent function does allow you to add a component to an assembly, but this component must already be loaded in Solidworks, so you need to:

- Create your empty assembly.

- Open your component to be integrated.

- Activate your empty assembly.

- Add your component to your empty assembly.

Try to use the latest versions of the functions so your AddComponent function should be replaced by the AddComponent5 function that you can find HERE.

Kind regards

1 Like

Hello, the AddComponent5 function works from which version of solidworks?

It's 2015

Hello

SOLIDWORKS 2010 FCS, Revision Number 18.0, it's marked at the bottom of the page I sent you.

Kind regards

1 Like

Hello

SOLIDWORKS 2010 FCS, Revision Number 18.0, it's marked at the bottom of the page I sent you.

Kind regards