Jump to content

Recommended Posts

Posted

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

Posted

@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

  • Thanks 1
Posted

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)))
)

 

  • Like 3
Posted

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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...