m1r Posted November 14, 2022 Posted November 14, 2022 Greetings my friends I need some help with this lisp, this lisp (Medz v3.lsp) it basically makes a measurement of all lines arc and put the results in an new excel file divided by layer, linetype, color and length, this lisp works well but i need help to make the follow a modification: I need that the results to be in a specifc excel file (see attach xlsx file) on the "MED AUX" tab with the range A11:D11, it seems a simple modification, but i don't have the knowledge to do it. Many thanks MedZ v3.lsp Mede Aux.xlsx Quote
pkenewell Posted November 14, 2022 Posted November 14, 2022 Try This. See the comments in the file for the changes. MedZ v3.lsp 3 Quote
m1r Posted November 14, 2022 Author Posted November 14, 2022 @pkenewell That's it, it's working, and it's a nice touch to have the option to select the xlsx file or respect the path. Many thanks 1 Quote
BIGAL Posted November 15, 2022 Posted November 15, 2022 Nicely done 1 step missing "MED AUX" is desired tab, as its opening an existing file the tab will exist or not so needs to be added. This is some examples that may be useful. I have my own version of a excel lisp with lots of defuns, started with getexcel.lsp. Just use the correct defuns. ; set current worksheet (defun setsheet ( sheetname / ) (setq xlSheets (vl-catch-all-apply 'vlax-get-property (list myxl "Worksheets"))) (setq curSheet (vl-catch-all-apply 'vlax-get-property (list xlSheets "Item" sheetname))) (vlax-invoke-method curSheet "Activate") ) ; add a sheetName by FIXO no longer with us (defun addsheet (NewSheetName / ) (setq xlSheets (vlax-get-property myBook "Sheets")) ;; add new sheet (vlax-invoke-method xlsheets 'Add nil nil nil) ;; get the number of sheets (setq xlCount (vlax-get-property xlSheets 'Count)) ;; get the newly created sheet (setq xlSheet (vlax-get-property xlSheets "Item" (vlax-get-property (vlax-get-property myXL 'ActiveSheet) 'Name))) ;; change name of sheet to what you need (vlax-put-property xlSheet 'Name NewSheetName) ;; move sheet to the end of book (vlax-invoke-method xlSheet 'Move (vlax-get-property xlSheets "Item" (vlax-get-property xlSheets 'Count))) ) 3 Quote
pkenewell Posted November 15, 2022 Posted November 15, 2022 Nice examples Al! FIXO's bit of code is especially useful in looking for the active worksheet and moving a new worksheet to the end of the tabs. Rest in Peace FIXO - your presence is still around with the great code you shared! 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.