OK, Good Morning Alan & Tim.....'twas a long night with an ill cat....
I did find an error in the RELOAD portion for the xref:
(vl-catch-all-apply '(lambda () (vla-reload (vla-item (vla-get-blocks doc) (vla-get-name ent)))))
is what it needs to be.
Alan, if it makes it past the (setq odbx....) without error then you already have ObjectDBX registered. I will check if there is an issue with the SaveAs in R2000......wait, if the SYSVAR XLOADCTL is set to anything other than 2 it will probably cause this. Here's a version that first Unloads the Xref so it can be edited than Reloads it.
;;=======================[ cUpdate.lsp ]=======================
;;; Author: Copyright© 2006 Charles Alan Butler
;;; Version: 1.11jm Jan. 03, 2006
;;; Purpose: To update attributes in a drawing, nested blocks & xref
;;; Ignores locked or Frozen layers
;;; Sub_Routines: -None
;;; Requirements: - Acad Versions 2000-2002 must have ObjectDBX registered before running
;;; Returns: -None
;;;==============================================================
;; ObjectDBX added to edit Xrefs by Jeff Mishler
;;
(defun c:cupdate (/ ss ent obj att blks newtext taglist)
(setq newtext "2006 C-n-R CORPORATION"
taglist '("COPYRIGHT" "COPYRIGHTYEAR")
)
;; converted majority to function for recursive use with xrefs, jm
(defun process_atts (doc / file odbx)
(vlax-for blk (vla-get-blocks doc)
(vlax-for ent blk
(if (and (vlax-property-available-p ent 'hasattributes)
(= (vla-get-hasattributes ent) :vlax-true)
)
(progn
(foreach att (vlax-invoke ent 'getattributes)
(if (member (vla-get-tagstring att) taglist)
(vl-catch-all-apply '(lambda ()
(vla-put-textstring att newtext)
))
;;added catch-all to catch possible locked layer error, jm
)
)
)
)
(if (and (vlax-property-available-p ent 'path)
(setq file (findfile (vla-get-path ent)))
(setq xrblk (vla-item (vla-get-blocks doc) (vla-get-name ent)))
)
(progn
(vla-unload xrblk)
(setq odbx (if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
(vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
(vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
))
(vla-open odbx file)
(process_atts odbx)
(vl-catch-all-apply '(lambda () (vla-saveas odbx file)))
(vlax-release-object odbx)
(vl-catch-all-apply '(lambda () (vla-reload xrblk)))
)
);;
)
)
)
(process_atts (vla-get-activedocument (vlax-get-acad-object)))
(princ)
)
(prompt "\nCopyright Update Loaded, Enter cupdate to run.")
(princ)
Tim, the alignment problem is only with Attributes and only when you change the alignment. Just changing the value does not cause a problem, IIRC. I'm pretty sure that Autocad already prevents you from creating the Xrefs in a loop. Although a problem is encountered with nested Xrefs, which is why the Reload is wrapped by the (vl-catch-all-apply).....you can't reload a nested xref, only the parent xref.