不喜歡文字三千行,代碼二十字,簡單上:
Public Function ProductProperties(ByVal Oproduct As Product, ByVal PropStr As String, OpIndex As String) As String
On Error Resume Next
Dim parameters1 As Parameters
Set parameters1 = Oproduct.UserRefProperties
Dim EvPara() As String, Ev As Integer, GetInfo(5) As String
Select Case OpIndex
Case "Create"
EvPara = Split(PropStr, "->")
parameters1.CreateString "單位名稱", EvPara(0)
parameters1.CreateString "圖紙名稱", EvPara(1)
parameters1.CreateString "圖紙編号", EvPara(2)
parameters1.CreateString "材料名稱", EvPara(3)
parameters1.CreateString "設計", EvPara(4)
parameters1.CreateString "Standard", EvPara(5)
ProductProperties = "Created"
Case "Read"
If parameters1.Count = 0 Then ProductProperties Oproduct, "單位->圖名->編号->材料->設計->No", "Create"
GetInfo(0) = parameters1.Item("單位名稱").ValueAsString
GetInfo(1) = parameters1.Item("圖紙名稱").ValueAsString
GetInfo(2) = parameters1.Item("圖紙編号").ValueAsString
GetInfo(3) = parameters1.Item("材料名稱").ValueAsString
GetInfo(4) = parameters1.Item("設計").ValueAsString
GetInfo(5) = parameters1.Item("Standard").ValueAsString
ProductProperties = Join(GetInfo, "->")
Case "Modify"
If parameters1.Count = 0 Then ProductProperties Oproduct, "單位->圖名->編号->材料->設計->No", "Create"
EvPara = Split(PropStr, "->")
parameters1.Item("單位名稱").ValuateFromString EvPara(0)
parameters1.Item("圖紙名稱").ValuateFromString EvPara(1)
parameters1.Item("圖紙編号").ValuateFromString EvPara(2)
parameters1.Item("材料名稱").ValuateFromString EvPara(3)
parameters1.Item("設計").ValuateFromString EvPara(4)
parameters1.Item("Standard").ValuateFromString EvPara(5)
ProductProperties = "Modified"
End Select
End Function
以上是完整示例,自己調整、稍作修改後即可用在工作中了,爽的話就贊就關注,我自己的作品示例:
,
更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!