Save BOM assembly in excel format with a macro

Hello

I use a macro to generate a table (found on the net).

I am looking to save a nomenclature in xls format, on my local ( C:\ for example ) from the assembly file via a macro .

Do you have an idea of the code?

Thank you in advance for your feedback

 

Yannick


generation_table_nomenclature.swp

Hello

Look by HERE, you should find what you want.

Kind regards

Thank you D.Roger

I don't really know macros in solidworks.

I tried to modify without success.I have a compilation error

Where can this come from?

 


generation_table_nomenclature.swp

You are missing the reference to "Microsoft Excel xx.0 Object Library".

Then

Kind regards

1 Like

Hello

Here is your (normally) functional macro.

Kind regards


generation_table_nomenclature.swp
1 Like

Good evening 

D.roger thank you for your feedback. I will have access to solidworks  on Monday.

Quick question, is it  possible as in excel to delete a row at the BOM via a macro?

The conditions for  deleting the row would be that there is no value in a box   of a specific column. 

 

Thank you

Good night 

Hello D.Roger.

I just tested your macro. It works perfectly.

I added a sort on column F, cell filled in first and empty after .

then deleting the rows containing the empty cells.

Thank you.

 

yannick

Hello, I just tested the macro but it doesn't work.

 Set swModel = swApp.ActiveDoc

Hello Anes Kerkeni,

Is it possible to have a little more detail because with so much information it's not going to be easy to guess why this macro supposedly doesn't work!!

Kind regards

@Anes Kerkeni  it would be better to give more explanation. Do you launch the macro from an assembly? You have modified a few lines,

And the best thing to do is to open a new topic and reference the previous one (link to the topic).

Did you add the link to MS EXCEL as requested?

Hello

I'm interested in this macro but I'd like to modify it so that it uses an excel template in which I have set up some things (macro that allows you to modify the properties in SW, list of drop-down choices)

I imagine that the section to be modified is the following,

Dim wbk                     As Excel.Workbook

 

or

 

' On ouvre un nouvel objet Excel
    Set xlApp = New Excel.Application
    
    ' On rend Excel visible avec un nouveau classeur
    With xlApp
        .Visible = True
        Set wbk = .Workbooks.Add
        Set sht = wbk.ActiveSheet
    End With

 

but I don't know how to indicate the path of my XLS model

Thank you for your help

 

 

 

 

Hello

Open a new discussion by attaching the macro, and the xls table driving.

More people will be able to answer you

Cdlt

1 Like