RepCad Posted March 2, 2019 Posted March 2, 2019 Hi guys, I open excel file and then close it after edit via autolisp, it works correctly , but Changes don't save : (vlax-invoke-method wbk 'Close :vlax-true) (vlax-release-object wbk) (vlax-invoke-method excel 'Quit) (vlax-release-object excel) can anyone help me? Quote
rlx Posted March 2, 2019 Posted March 2, 2019 (vl-catch-all-apply 'vlax-invoke-method (list wbk "Save"))) ? 1 Quote
RepCad Posted March 2, 2019 Author Posted March 2, 2019 Yes, I put put that code but it doesn't save again : (vl-catch-all-apply 'vlax-invoke-method (list wbk "Save") ) (vlax-invoke-method wbk 'Close :vlax-true) (vlax-release-object wbk ) (vlax-invoke-method excel 'Quit) (vlax-release-object excel) Quote
rlx Posted March 2, 2019 Posted March 2, 2019 (edited) hard to tell without sample from your lisp and your excel workbook. You could try to find out if saving works at all (if (vl-catch-all-error-p (setq err (vl-catch-all-apply 'vlax-invoke-method (list wbk "Save")))) (prompt (strcat "\nError: " (vl-catch-all-error-message err)))) make sure you are saving the workbook and not just the active sheet maybe this is a good read : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/save-and-close-excel-worksheet/td-p/864033 there a many excel posts on this forum (Bigal even wants to give them their own seperate forum ) GetExcel.lsp Edited March 2, 2019 by rlx 1 Quote
RepCad Posted March 3, 2019 Author Posted March 3, 2019 Thank you for the lisp, I have another question, how can I find last row in column, for example column "A" ? (via autolisp) Quote
rlx Posted March 3, 2019 Posted March 3, 2019 in my loop generator app (LG) I use : (if (and LG-ExcelApp LG-ExcelWorkBook LG-ExcelSheet) (progn (setq CurRegion (vlax-get-property LG-ExcelSheet 'UsedRange)) (setq LG-XlsMaxRow (vlax-get-property (vlax-get-property CurRegion "Rows") "Count")) (setq LG-XlsMaxCol (1+ (vlax-get-property (vlax-get-property CurRegion "Columns") "Count")))))) just subst. your names for the excel-app / workbook / sheetname 1 Quote
Recommended Posts
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.