Copieng property values from Excel into SLDASM

Hello all,

At work I have to put 6 values into the custom propertyes of several assembly files. These files can have configurations, but the properties stay the same within a file. I also have a list in Excel which contains the values of each property for each file.

Now my question:

Does somebody have a utillity for reading property values from an Excel file and put these into a SWX Assembly custom property?

Thanks in advance for your help,

JD

Reply to
Jan Derk
Loading thread data ...

No real need for a utility, Jan, unless you just want one. What you do is insert a new Design Table in the SLDASM file(s) you want to change, then you can Copy/Paste from your Excel file to the Design Table in each Assembly. Each custom property column HEADER must be preceded by $PRP@ just as you would normally do in a Design Table. The entries will show up as Configuration Specific custom properties, so if you have more than one assembly configuration you need to have a row of values for each configuration.

BTW, you can also drive the part number that ends up in the BOM this way by inserting $PARTNUMBER as a column header with the desired value for each configuration. It's does the same thing as right-clicking on the configuration name (in the Configuration Manager tab) and selecting "User Specified Name" under "Part number displayed when used in a bill of materials".

Further BTW, I note that sometimes either Excel or SolidWorks (don't know which) refuses to permanently accept the changes made to the Design Table. The workaround in to open Excel independently first (open your template file with your custom properties in it), then right-click on your SolidWorks file's Design Table and choose "Edit Table in Separate Window". You'll then have both windows open in Excel and you can Copy/Paste from one to the other.

'Spork'

Jan Derk wrote:

Reply to
Sporkman

Jan, If you still think you'd like to have a utility to do this, I'd be happy to make one for you.

--Brenda

----------------------------------------------- Brenda D. Bosley

formatting link

Reply to
Brenda D. Bosley

I've pasted in the text from a thread on another discussion group that looks like what you want to do. You might get ahold of Stuart to see where he went with this one.

WT Yes that's what I'm trying to do, I made significant progress last night, (after I learnt a bit about importing object libraries) I can now read from a cell in excel, yay! I was then going to use parts of dereks custom properties macro to add the cell contents to the solidworks file, And then I was hopefully going to get it to step through all the files populating them correctly (provided they have their filenames are spelt correctly.

Here is my code: Sub main() Dim appxl As Excel.Application Dim partno As String Dim myobj As Object Set myobj = GetObject("C:\Documents and Settings\Stuart Young\MyDocuments\XTRA 2002\parts2.xls") Workbooks.Open Filename:="C:\Documents and Settings\Stuart Young\MyDocuments\XTRA 2002\parts2.xls" Cells(2, 2).Select Selection.Copy Workbooks.Add Cells(1, 1).Select ActiveSheet.Paste ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Stuart Young\MyDocuments\XTRA 2002\testfile.xls" ActiveWorkbook.Close 'close books ActiveWorkbook.Close End Sub

Any guidance would be appreciated

Stuart Young

Design Engineer,

****************************************

Gelârt International Ltd/ Medix 21 Ltd Box 54117 Mana Paremata Wellington New Zealand

formatting link
snipped-for-privacy@xtra.co.nz tel +64 4 233 0925 fax +64 4 233 0982

****************************************

-----Original Message-----

From: snipped-for-privacy@pacificautomation.com [mailto: snipped-for-privacy@pacificautomation.com] Sent: Thursday, September 04, 2003 4:21 AM To: snipped-for-privacy@topica.com Subject: RE: [CAD] API tips

What exactly are you trying to do? What I am seeing is that you want excel to populate your custom properties with data from the cells? If so, yes it can be done and I will show you what I'm thinking if that is the case. If it is, let me know which version of SolidWorks your wanting to do this with (2001Plus, 2003, 2004??).

John

-----Original Message-----

From: Stuart Young [mailto: snipped-for-privacy@xtra.co.nz] Sent: Tuesday, September 02, 2003 5:18 PM To: snipped-for-privacy@topica.com Subject: RE: [CAD] API tips

Can anyone guide me on how to import data from Excel into a solid works macro so that I could then write it into the custom properties using a derivative of Derek's macro? Something along the line of

Open excellfile. "C:\partdata.xls" Cells (1, 1).select Part number = selection Cells (1,2).select Description = selection Cells (1,3).select Cost = selection Etc.....

Can this be done? Code that works in Excel macros doesn't appear to be recognized in solidworks macros, Are they slightly different languages?

Cheers Stuart Young Design Engineer,

****************************************

Reply to
Wayne Tiffany

Make sure you quit excel. I noticed that in the Task Manager that you can end up with 8 or so instances of excel that are all hidden.

appxl.Quit

Reply to
Corey Scheich

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.