UserParamter

UserParamter

GeorgK
Advisor Advisor
318 Views
2 Replies
Message 1 of 3

UserParamter

GeorgK
Advisor
Advisor

Hello together,

 

I create a Userparamter:

 

 

Public Sub CreateTextUserParameter()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oUserParameters As UserParameters
    Set oUserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
    
    Dim oTextParam As UserParameter
    Set oTextParam = oUserParameters.AddByValue("Printer_Name", "3DPrinter", kTextUnits)
       
End Sub

 

This does not work:

 

Dim oParam As Parameter

        For Each oParam In doc.ComponentDefinition.Parameters
            If oParam.Name = "Printer_Name"  Then
                If oParam.Expression = "3DPrinter" Then

                               MsgBox(oParam.Expression)
                End If
            End If
        Next

 

But how could I check if the value exists and get the textvalue?

 

Thank you Georg

0 Likes
Accepted solutions (1)
319 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Hi,

Kindly find the code below which works

 

Dim oParam As Parameter
doc = ThisApplication.ActiveDocument
For Each oParam In doc.ComponentDefinition.Parameters
MsgBox(oParam.Name +" -- " +oParam.Expression)
If oParam.Name = "Printer_Name" Then
If oParam.Expression = """3DPrinter""" Then

MsgBox(oParam.Expression)
End If
End If
Next


Message 3 of 3

GeorgK
Advisor
Advisor

Thak you very much. That solves the problem.

0 Likes