×
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

Macro to populate custom properties

Macro to populate custom properties

Macro to populate custom properties

(OP)
Hi all,

I have a macro to populate custom properties of SW file.

There are two things I need to be added and was hoping someone could help me (my VBA knoledge is very low).

1) Remove all exsisting custom properties
2) Get the filename so that Material and Weight are properley set.
"SW-Material@Part1.SLDPRT"

CODE

Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc

Dim MyProp(1, 20) As String

'Property names
MyProp(0, 0) = "PartNo"
MyProp(0, 1) = "Title"
MyProp(0, 2) = "Production"
MyProp(0, 3) = "Description"
MyProp(0, 4) = "Remarks"
MyProp(0, 5) = "CheckedBy"
MyProp(0, 6) = "CheckDate"
MyProp(0, 7) = "Amount"
MyProp(0, 8) = "L"
MyProp(0, 9) = "W / d"
MyProp(0, 10) = "H / t"
MyProp(0, 11) = "Prop1"
MyProp(0, 12) = "Prop2"
MyProp(0, 13) = "Prop3"
MyProp(0, 14) = "Below should not be edited"
MyProp(0, 15) = "Revision"
MyProp(0, 16) = "Author"
MyProp(0, 17) = "Mass"
MyProp(0, 18) = "Material"
MyProp(0, 19) = "Project"
MyProp(0, 20) = "Number"


'Property values

MyProp(1, 0) = "[C1_00_00_00]"
MyProp(1, 14) = "Below should not be edited"
MyProp(1, 17) = "SW-Mass@Part1.SLDPRT"
MyProp(1, 18) = "SW-Material@Part1.SLDPRT"



Dim m As Integer

For m = 0 To 20
    retval = Part.AddCustomInfo3("", MyProp(0, m), 30, _
         MyProp(1, m))
Next m

End Sub

RE: Macro to populate custom properties

(OP)
Thank you for your reply, I edited the macro but its a bit overwhelming.

 

RE: Macro to populate custom properties

It's a bit of an antique, circa 2004.

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