Update Table's Data Link Values

Update Table's Data Link Values

Anonymous
Not applicable
1,296 Views
3 Replies
Message 1 of 4

Update Table's Data Link Values

Anonymous
Not applicable
Is there a way to update a table's data linked values through VBA? I see to datalink classes, but all their members are constants. And I don't see anything in the table's class. Is there a library I'm missing?
0 Likes
1,297 Views
3 Replies
Replies (3)
Message 2 of 4

pjfontes
Advocate
Advocate
^ anyone have an answer to this? I've been searching for an hour!
0 Likes
Message 3 of 4

a.gnodde
Contributor
Contributor

I am working on an batch script to update the data links in multiple files. Untill now i have this:

 

NewDoc.SendCommand "DATALINKUPDATE" & vbCr & "U" & vbCr & "K" & vbCr

 

Which works fine on files whith data links, but when there are non the last K should not be executed. So i am searching for an check if there are data links in the file. Could anyone have an clue where to find them?

 

 

Regards, Albert

0 Likes
Message 4 of 4

Anonymous
Not applicable

Try testing the following condition in order to see whether there are data links or not:

 

 

AutoCAD.AcadApplication.ActiveDocument.Dictionaries.Item("ACAD_DATALINK").count > 0

 

You may need to set a VBA project reference for the 'AutoCAD 2019 Type Library' library (stored @' C:\Program Files\Common Files\Autodesk Shared\acax23enu.tlb' on my computer), to get the above code to work.

 

Your NewDoc.SendCommand... code seems inelegant. Do you not have a better way to modify data links for live open unsaved AutoCAD 'projects'?

 

Thanks,

 

Mark

 

0 Likes