vba and changing field values

can anyone help me with this? I am trying to change the value of fields with vba. I have a program that draws a full drawing from excel but I cant get the field values to change in the process.

Comments

  • jaekma
    edited May 2017

    keep solving my own issues.

    here is how you change the values of your fields (via vba) under drawing properties

    Dim Value As String
    Dim Num As Long
    Dim Index As Long
    Dim CustomKey As String
    Dim CustomValue As String
    Dim Sum As AcadSummaryInfo
    Set Sum = ThisDrawing.SummaryInfo
    
    Num = Sum.NumCustomInfo
    
    For Index = 0 To Num - 1
        Sum.GetCustomByIndex Index, CustomKey, CustomValue
        If CustomKey = fillArray(Index) Then
            Sum.SetCustomByIndex Index, CustomKey, "Test"
        End If
    Next Index
    
    Set Sum = Nothing
    

    I found the necessary code here:forums.augi.com/showthread.php?94942-Drawing-Properties

    I altered it to fit my needs. It is my intention to use this information to populate my fields with values from an excel sheet.

  • Your use of the word 'field' is confusing. Without the additional info of your 2nd post most BricsCAD users (and programmers) would probably think of this first:
    https://www.bricsys.com/bricscad/help/en_INTL/CurVer/UsrGui/source/10_Drawing_Entities/05_Working_with_Text/10_05_08_Working_with_Fields.htm#Commands

  • Roy,
    those are the droids fields I'm looking for. For example our title block (like most peoples title blocks) use custom fields (drawing properties) across all layouts to make sure all the title data matches. These are the fields I could not find information about changing via VBA (until yesterday). As most cad users i searched "how to update fields with vba" when i should have been searching "summaryinfo"

    does this make more sense?

  • jaekma
    edited October 2017

    nvm

This discussion has been closed.