Jump to content

How to unlock table cell after removing datalink using AutoLISP.?


Recommended Posts



I have 5000 drawings that contains three specific tables. All these tables are linked to external Excel using data links. 


The main issue i have is, after the data link is removed the cell content of all three tables remain locked. Is there any way to unlock the cells using lisp??. I know i can do it manually but i don't want to go that route unless it is the only the way to do so. 


Please take a look at the drawing & lsp file. Trial.dwg


Thank you very much.




Link to comment
Share on other sites

(defun AH:unlockcell ( / x y)
(setvar 'ctab "Model")
(setq y 0)
(setq ss (ssget "X" (list (cons 0 "ACAD_TABLE"))))
(repeat (setq X (sslength ss))
(setq obj (vlax-ename->vla-object(ssname ss (setq x (- x 1)))))
(setq nRows (- (vla-get-rows obj) 1))
(setq nCols (- (vla-get-Columns obj) 1))
(setq row 0) 
(setq cell 0)
 (vla-put-RegenerateTableSuppressed obj :vlax-true)
     (while (<= row nRows)
(while (<= cell nCols)
  (vla-setcellstate  obj row Cell 0)
  (setq cell (1+ cell))
  (princ (strcat "\nRow : " (itoa row) " , cell " (itoa cell)))
(setq row (1+ row))
(setq cell 0)
     (vla-put-RegenerateTableSuppressed obj :vlax-false)


Link to comment
Share on other sites

The above code selects all tables with 1 or more columns and unlocks the content of the cells for all tables within the drawing. 


looked thru so many thread and combined so many codes to come up with this code. 



thank you all very much helping me out. 




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...