yhyqyx 发表于 2023-8-27 11:08:14

输出文字到word的程序报错!

输出文字到word的程序,但是当多个CAD同时运行此函数时会报错,估计是同时调用WORD的问题,应该怎样修改呢?
(setq wrd_app (vlax-get-or-create-object "Word.Application"))
(vla-put-visible wrd_app :vlax-true)
(vlax-put-property wrd_app 'ScreenUpdating :vlax-false)
(setq wrd_docs (vlax-get-property wrd_app 'Documents))
(vlax-invoke-method wrd_docs 'Open doc_name :vlax-false)
(setq wrd_doc (vlax-get-property wrd_app 'Activedocument))
(vlax-invoke-method wrd_doc 'Activate)
(write_to_end wrd_app txt1)
(vlax-put-property wrd_app 'ScreenUpdating :vlax-true)
(vlax-invoke-method wrd_doc 'Saveas doc_name)
(vlax-invoke-method wrd_doc 'Close)
页: [1]
查看完整版本: 输出文字到word的程序报错!