Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help verifying items

Status
Not open for further replies.

tractng

MIS
Sep 26, 2005
21
US
Guys,

The codes work when the value matches the listed items from the material component.

Since I am reading the value from another place, the end users might have entered "steels" instead of "steel".

Any codes that I can check to see it matches, if it doesn't match then I want a message box to display. Below is what I am trying to achieve but the code doesn't work - getting an error about object required.

Thanks,
Tony


--------This one works-----------------

Dim oPdoc As PartDocument

Set oPdoc = oDoc1

Dim oComp As ComponentDefinition
Set oComp = oPdoc.ComponentDefinition

'Debug.Print oPdoc.ComponentDefinition.Material.name

Dim sTemp As String

sTemp = "Steel"

Dim oMat As Material
Set oMat = oPdoc.Materials(sTemp)

oPdoc.ComponentDefinition.Material = oMat

Debug.Print oPdoc.ComponentDefinition.Material.name


End Sub

----------- Trying to achieve, but codes doesn't work ---
Public Sub ChangeMat()

Dim oPdoc As PartDocument

Set oPdoc = oDoc1

Dim oComp As ComponentDefinition
Set oComp = oPdoc.ComponentDefinition

'Debug.Print oPdoc.ComponentDefinition.Material.name

Dim sTemp As String

sTemp = "Steel"

Dim oMat As Material
Set oMat = oPdoc.Materials(sTemp)

If oPdoc.ComponentDefinition.Material <> oMat Then

MsgBox "Must select manually from the list", vbInformation, ""

Else


Debug.Print oPdoc.ComponentDefinition.Material.name

End If

End Sub

 
What application are you using? May be helpful.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top