VBA error

VBA error

k14348
Advocate Advocate
381 Views
1 Reply
Message 1 of 2

VBA error

k14348
Advocate
Advocate
Sub TitleUpdate()

Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

Dim oPartDoc As PartDocument
Dim oProp As Property

For Each oPartDoc In oAsmDoc.AllReferencedDocuments
    For Each oProp In oPartDoc.PropertySets.Item("Inventor Summary Information").Item("Title")
    oProp.Value = "Comp"
    Next
Next
End Sub

Hi all,

       Can anybody help on this code error? 

 

Thanks,

Regards,

Karth

0 Likes
Accepted solutions (1)
382 Views
1 Reply
Reply (1)
Message 2 of 2

JelteDeJong
Mentor
Mentor
Accepted solution

the problem is that its only possible to iterate lists. You are trying to iterate 1 iProperty. try this:

Sub TitleUpdate()

    Dim oAsmDoc As AssemblyDocument
    Set oAsmDoc = ThisApplication.ActiveDocument
    
    Dim oPartDoc As PartDocument
    Dim oProp As Property
    
    For Each oPartDoc In oAsmDoc.AllReferencedDocuments
        oPartDoc.PropertySets.Item("Inventor Summary Information").Item("Title").Value = "Comp"
    Next
End Sub

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com