×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

File Properties extracting with VBA

File Properties extracting with VBA

File Properties extracting with VBA

(OP)
Hello,

I want to extract my file properties to a spread sheet.  I found some code below, but I believe it needs some tweeking.  I am no programmer, that's for sure.  Can anyone take a crack at this thing, and make it work as a macro for excel?

SYMPTOM/PROBLEM
---------------
How do you extract the file properties for a Solid Edge file using VB
Automation API?


SOLUTION/WORKAROUND
-------------------
All the file properties that are listed under the "File/Properties" dialog can
be extracted by a VB propgram or a VBA macro in a spreadsheet.    Just make sure
that your project has a reference to the type library called "Solid Edge File
Properties".  The sample code below can be modified to suit your needs:

Sub GetFileProps()
Dim objPropSets As PropertySets
Dim objProps As Properties
Dim objProp As Property


Set objPropSets = CreateObject("SolidEdge.FileProperties")
Call objPropSets.Open("c:\temp\Part1.par")

'For Each objProps In objPropSets
'    For Each objProp In objProps
'     Debug.Print objProps.Name, ": ", objProp.Name, " = ", objProp.Value
'    Next
'Next

Set objProps = objPropSets.Item("ProjectInformation")
For Each objProp In objProps
    Debug.Print objProp.Name, " = ", objProp.Value
Next

Set objProps = objPropSets.Item("SummaryInformation")
For Each objProp In objProps
    Debug.Print objProp.Name, " = ", objProp.Value
Next


Set objProps = objPropSets.Item("MechanicalModeling")
For Each objProp In objProps
    Debug.Print objProp.Name, " = ", objProp.Value
Next

Set objProps = objPropSets.Item("Custom")
For Each objProp In objProps
    Debug.Print objProp.Name, " = ", objProp.Value
Next

End
End Sub

RE: File Properties extracting with VBA

There used to be pdf on customizing solid edge on the UGS web site but I can't locate it.
It was V15 but there was a section on how to get file properties, which hasn't really changed.
I have it somehere and will post later when I find it.

bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.

RE: File Properties extracting with VBA

(OP)
Sounds good. I could really use it.

Thanks.

RE: File Properties extracting with VBA

Page 161 shows how to get all file properties.
If you get the properties one section at a time you need to be careful because some do not exist in certain file types. I think it's the MechanicalModeling property set that does not exist in a draft file.
I had this problem when I was learning and had to check the file type so that I didn't get an error.

bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.

RE: File Properties extracting with VBA

(OP)
Cool.  I'll keep that in mind.  My problem is that I 100% to vb programing or programming of any kind. Don't suppose anyone out there has already got an excel macro done up for this,eh?

RE: File Properties extracting with VBA

I think I have a program that gets all models linked to a draft file and saves the result in a text file.
This would show you how to create a new file and add information to it.
If you think it may be of help I'll have a look and post it later.
The code is probably not the best but it does work, and like you I'm self-taught and not an expert, so that's my excuse.

bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.

RE: File Properties extracting with VBA

(OP)
Sweet, I'll take it. Any example/resource I can get will help, and I need alot of help.  On the Microsoft website there are a whack of tutorials for VB.  I've down loaded the express addition and have started trying to learn. Hopefully I start getting the hand of it soon.

Thanks,

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources