Visual Basic: Adding custom property to file with macro
Visual Basic: Adding custom property to file with macro
(OP)
All I'm trying to do (as that famous line goes) is run a macro that will automatically add a custom property to a file. I'm going to be running it multiple times after I get this working. The property is LibraryChecked and the value is going to be "Yes" of type Text. Not a YesOrNo type.
Here's the code I have to start. If its confusing its because I'm confused. Can anyone help me with this?
Code:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim blnRetval As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Part.FileSummaryInfo
'blnRetval = ModelDoc.AddCustomInfo3("", "LibraryChecked", swCustomInfoText, "Yes")
'blnRetval = Part.AddCustomInfo3("", "LibraryChecked", swCustomInfoText, "Yes")
'blnRetval = ModelDoc.Save3(swSaveAsOptions_Silent, lngErr, lngWarn)
End Sub
__________________
Jeremy (VB 6.0)
Every man dies, but not every man lives. - William Wallace
Here's the code I have to start. If its confusing its because I'm confused. Can anyone help me with this?
Code:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim blnRetval As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Part.FileSummaryInfo
'blnRetval = ModelDoc.AddCustomInfo3("", "LibraryChecked", swCustomInfoText, "Yes")
'blnRetval = Part.AddCustomInfo3("", "LibraryChecked", swCustomInfoText, "Yes")
'blnRetval = ModelDoc.Save3(swSaveAsOptions_Silent, lngErr, lngWarn)
End Sub
__________________
Jeremy (VB 6.0)
Every man dies, but not every man lives. - William Wallace






RE: Visual Basic: Adding custom property to file with macro
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: Visual Basic: Adding custom property to file with macro
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: Visual Basic: Adding custom property to file with macro
The last line would also read:
blnRetval = Part.Save3(swSaveAsOptions_Silent, lngErr, lngWarn)
RE: Visual Basic: Adding custom property to file with macro
Somehow, it actually works. I don't understand what the variable blnRetval is doing, but anyway, I run the macro and it just goes to an error. I click cancel, stop, whatever and when I run it a second time, that's when it enters this information into the property list. How can I do it cleanly?
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim blnRetval As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Part.FileSummaryInfo
blnRetval = Part.AddCustomInfo3("", "LibraryChecked", swCustomInfoText, "Yes")
blnRetval = Part.Save3(swSaveAsOptions_Silent, lngErr, lngWarn)
End Sub
RE: Visual Basic: Adding custom property to file with macro