Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[V8i VBA] Help to improve code to update reference logical names.

$
0
0

With some help from Bentley support I have some simple VBA code that looks at the logical name stored in the model of a reference file and then updates the logical name where it's attached with that value. Currently I have to code what reference files to update within the VBA via an "if" statement. I'm wondering if there is an easy way to move this part of the code outside of the VBA to be easier to edit for use on different references? 

This may be easy or it may not, I have little programming knowledge. I can usually understand what is happening within the code, but I don't know the proper syntax or format to make things work.

Here is the code as I currently have it. Any help or input is appreciated. 

Sub SetLogNameAsDefLogName()
    Dim att As Attachment
    
    For Each att In ActiveModelReference.Attachments
        If att.AttachName = "303881-TB.dgn" Or att.AttachName = "303881-Align.dgn" Or att.AttachName = "303881-Const.dgn" Or att.AttachName = "303881RW.dgn" Or att.AttachName = "303881topo.dgn" Then
           att.LogicalName = att.DefaultLogicalName
           att.Rewrite
        End If
    Next
End Sub

 


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>