Solved

Extract Solid Works file properties to a file

Posted on 2012-04-12
2
581 Views
Last Modified: 2012-04-12
Our design team uses Solid Works and have 1000's of files.

Does anyone know how to extract the properties of all files in a folder and store them in a database (using VB/VBA)?

Or give me a place to start?
0
Comment
Question by:HKFuey
  • 2
2 Comments
 

Accepted Solution

by:
HKFuey earned 0 total points
Comment Utility
Sub main()

Dim swApp As Object
Sub main()
Dim Part As SldWorks.ModelDoc2
Dim PartNumber As String
    Set swApp = Application.SldWorks

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile("C:\File.csv", True)

    FileName = Dir("C:\Temp\*.SLDPRT")
    Visibility = swApp.DocumentVisible(False, swDocPART)
    a.writeline ("Part Number" & "," & "Description")

    Do While FileName <> ""
        Set Part = swApp.OpenDoc("C:\Temp\" & FileName, swDocPART)
        Description = Part.GetCustomInfoValue("", "DESCRIPTION")
        PartNumber = Part.GetCustomInfoValue("", "Part_No.")
        a.writeline (PartNumber & "," & Description)
        swApp.CloseDoc FileName
        FileName = Dir
    Loop

    Visibility = swApp.DocumentVisible(True, swDocPART)

End Sub
0
 

Author Closing Comment

by:HKFuey
Comment Utility
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now