DimCADappAsObjectPublicFunctionIVersion()AsString'È¡°æ±¾ºÅOnErrorResumeNextSetCADapp=GetObject(,AutoCAD.Application)IfErr.Number0ThenSetCADapp=CreateObject(AutoCAD.Application)EndIfCADapp.Visible=TrueIVersion=Left(CADapp.Version,2)EndFunctionPublicFunctionIobjDbx()AsObject'»ñÈ¡½Ó¿Ú°æ±¾Version=IVersionIfCInt(Version)16ThenSetIobjDbx=CADapp.GetInterfaceObject(ObjectDBX.AxDbDocument)ElseSetIobjDbx=CADapp.GetInterfaceObject(ObjectDBX.AxDbDocument.&Version)EndIfEndFunctionPublicFunctionlayoutcopy(DocumentobjAsObject,SourcelayoutNameAsString,TargetlayoutNameAsString)AsObject'¸´ÖƲ¼¾ÖDimmylayoutAsObjectDimobjArray()AsObjectDiment()AsObjectDimlngCountAsLong,iAsLonglngCount=Documentobj.Layouts(SourcelayoutName).Block.CountSetmylayout=CADapp.Application.activeDocument.Layouts.Add(TargetlayoutName)IflngCount0ThenReDimobjArray(0TolngCount-1)Fori=0TolngCount-1SetobjArray(i)=Documentobj.Layouts(SourcelayoutName).Block.Item(i)Nextmylayout.CopyFromDocumentobj.Layouts(SourcelayoutName)Documentobj.Database.CopyObjectsobjArray,mylayout.BlockSetlayoutcopy=mylayoutEndIfEndFunctionSubTest()DimDocumentobjAsObjectSetDocumentobj=IobjDbxDocumentobj.Openc:\xxx.dwtlayoutcopyDocumentobj,xxx.dwtÖв¼¾ÖÃû³Æ,Ö¸¶¨Ð²¼¾ÖÃû³ÆSetDocumentobj=NothingSetCADapp=NothingEndSub