I Want modify 'Attribute block extraction to EXCEL' Lisp so that the sheet name is attribute block Tag value or name of the attribute block.

I Want modify 'Attribute block extraction to EXCEL' Lisp so that the sheet name is attribute block Tag value or name of the attribute block.

Ganesha_Durga
Participant Participant
446 Views
3 Replies
Message 1 of 4

I Want modify 'Attribute block extraction to EXCEL' Lisp so that the sheet name is attribute block Tag value or name of the attribute block.

Ganesha_Durga
Participant
Participant

Hello, everyone.

If you enter the information of the CAD attribute block into the Excel sheet using the attached 'LeeMac Lisp', all the attribute block information will be entered into one sheet. I would like to rename the Excel sheet based on the input value of the 'category tag' in the attribute block and create each sheet individually.

Alternatively, I would like to create each Excel sheet individually with the property block name.

I need your help.

 

0 Likes
447 Views
3 Replies
Replies (3)
Message 2 of 4

Sea-Haven
Mentor
Mentor

This may be a start not tested and is set up for "MYXL" application.

 

 

; add a sheetName by FIXO no longer with us
(defun addsheet ()
(setq  xlSheets (vlax-get-property myxl "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)))
)

Workbook is each Excel file, sheets are pages inside a workbook.

 

0 Likes
Message 3 of 4

Ganesha_Durga
Participant
Participant
I want to make an Excel sheet with the name of the attribute block. Is it possible to change it like that?
0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

Thats what the code is doing, adding a sheet, change "myxl" to "xlapp" so matches Lee's code. But its up to you to work out the correct postion to call the add sheetname defun.

 

A bit odd a sheet for each block would be easier to just add a new starting row with next block name. Followed with attribute details. 

0 Likes