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
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
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
Thanks.
RE: File Properties extracting with VBA
Good luck.
bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.
RE: File Properties extracting with VBA
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
RE: File Properties extracting with VBA
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
Thanks,