Guys,
How do I keep/write the variables on the section of the "For Each". I want to be able to store them in memory and write them to another file of the property page called (Part1.ipt). Right now, I can read the value. Not sure what to do it from there.
Btw, the field has a value and a name associated (under a typical "custom" tab of a property page).
Thanks,
Toan
-----------------------------------------------------
Sub Update1()
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
Set oApplication = GetObject(, "Inventor.Application")
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
Dim oDoc1 As Document
Set oDoc = oApplication.ActiveDocument
Set oDoc1 = oApplication.Documents.ItemByName("C:\my working directory\Part1.ipt")
' Obtain the PropertySets collection object
'Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
Set oPropsets1 = oDoc.PropertySets
Set oPropsets2 = oDoc1.PropertySets
Set oPropsets3 = oDoc1.PropertySets
' Get a reference to the "Description" property.
Dim oProp As Property
Dim oProp1 As Property
Dim oProp2 As Property
Dim oProp3 As Property
'==========================================================
'reading the current active file (value from property page)
'project tab of property page - field 5
myval = oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDescriptionDesignTrackingProperties).value
'=====================================================================
'writing to a non-active file,
'non-active file is in the background opened by the same program
'project tab of property page - field 5
Set oProp2 = oPropsets2.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDescriptionDesignTrackingProperties)
oProp2.value = myval
'============================================================
' reading custom property page tab from active file
'custom tab of propety page
Set oPropsets1 = oDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
Dim name As String
Dim propid As Long
Dim value As Variant
Dim sValue As Variant
For Each oProp In oPropsets1
Debug.Print oProp.DisplayName, oProp.value
name = oProp.name
value = oProp.value
propid = oProp.propid
Next
'============================================================
'writing to a non-active file,
'non-active file is in the background opened by the same program
'custom tab of property page
Set oProp3 = oPropsets3.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
oProp3.value = name
End Sub
How do I keep/write the variables on the section of the "For Each". I want to be able to store them in memory and write them to another file of the property page called (Part1.ipt). Right now, I can read the value. Not sure what to do it from there.
Btw, the field has a value and a name associated (under a typical "custom" tab of a property page).
Thanks,
Toan
-----------------------------------------------------
Sub Update1()
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
Set oApplication = GetObject(, "Inventor.Application")
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
Dim oDoc1 As Document
Set oDoc = oApplication.ActiveDocument
Set oDoc1 = oApplication.Documents.ItemByName("C:\my working directory\Part1.ipt")
' Obtain the PropertySets collection object
'Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
Set oPropsets1 = oDoc.PropertySets
Set oPropsets2 = oDoc1.PropertySets
Set oPropsets3 = oDoc1.PropertySets
' Get a reference to the "Description" property.
Dim oProp As Property
Dim oProp1 As Property
Dim oProp2 As Property
Dim oProp3 As Property
'==========================================================
'reading the current active file (value from property page)
'project tab of property page - field 5
myval = oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDescriptionDesignTrackingProperties).value
'=====================================================================
'writing to a non-active file,
'non-active file is in the background opened by the same program
'project tab of property page - field 5
Set oProp2 = oPropsets2.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDescriptionDesignTrackingProperties)
oProp2.value = myval
'============================================================
' reading custom property page tab from active file
'custom tab of propety page
Set oPropsets1 = oDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
Dim name As String
Dim propid As Long
Dim value As Variant
Dim sValue As Variant
For Each oProp In oPropsets1
Debug.Print oProp.DisplayName, oProp.value
name = oProp.name
value = oProp.value
propid = oProp.propid
Next
'============================================================
'writing to a non-active file,
'non-active file is in the background opened by the same program
'custom tab of property page
Set oProp3 = oPropsets3.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
oProp3.value = name
End Sub