Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/28/2022 in all areas

  1. Someone with a similar problem posted a query over at the AutoDesk AutoCAD forum and one response was to mention that both programs had to be installed in order to import a PDF file into a DWF file.
    1 point
  2. I have yet to find a satisfactory solution to your problem.
    1 point
  3. Exceed can replace the subload with some thing like this. No need to check registery. The MS stuff like Excel, Word, Access are like registered applications have seen same with Adobe products. I ahve tried to find a list of the "Applications" with no success. (defun ahchkexcel (filename / ) (if (= (setq myxl (vlax-get-object "Excel.Application") ) nil) ; if open already (setq myxl (vlax-get-or-create-object "excel.Application")) ; open excel ) do more excel stuff like check filename ......... .......
    1 point
  4. ; ESCUR, ESADD, ESDEL, ESUHD / ECSEL, ECPUT, ECGET, ECADR - 2022.03.30 exceed ; https://www.cadtutor.net/forum/topic/74681-cad-output-excel-specified-page/#comment-591539 ; before you run this lisp - Open both CAD and Excel. ; If multiple Excel windows are open, the top Excel window is selected. ; The order can be changed with Alt+Tab. Place the target Excel window right behind the CAD ; It is NOT executed when a cell value or formula is being edited (in edit mode) ; It is NOT executed when a save prompt is floating, or any other excel dialog box is running. ; please complete all these tasks and run this lisp ; 1. Excel Sheet Control Lisp ; ESCUR - change current excel sheet ; If you enter ESCUR, the sheet name list of the Excel workbook is displayed. ; when you enter a sheet order number, the active sheet changes to that sheet. ; hidden sheets are included in the list. If you enter a hidden sheet number, ; you cannot see it before you modify the property, so in this case, another sheet will be selected. ; ESADD - add new excel sheet ; If you enter ESADD, you can select the list of sheets in the current Excel and where to add them. ; If you press the space bar without entering anything, it will be created at the end. ; You must enter a sheet name. ; Duplicate name check function is added. ; (ex:esadd "1" "sheetnameyouwant") ; this is sub routine module, for insert ESADD to another lisp ; "1" - means sheet order number. this is string, NOT NUMBER format. it can have "" empty value. this mean add the last sheet. ; "sheetnameyouwnat" - new sheet name. this is string ; example 1 ; (ex:esadd "" "MySheet1234") ; this will find MySheet1234 in your Excel Workbook. if it doesn't have that sheet. it will add the last sheet "MySheet1234" ; if it has "MySheet1234", just activate MySheet1234 sheet. ; example 2 ; (ex:esadd "3" "MySheet1234") ; find "MySheet1234" and if it doesn't have. add 3rd sheet "MySheet1234", old sheets after 3rd sheet, go to back from 4th sheet. ; if it has "MySheet1234", just activate MySheet1234 sheet. ; ESDEL - delete excel sheet ; Since the Excel workbook has to have at least one sheet, it escapes when there is one left. ; ESUHD - unhide all hided sheets ; 2. Excel Cell Control Lisp ; ECSEL - select active cell command ; visible cursor does not move. but, in Excel, address field in the upper left corner, you can see that the active cell has been changed. ; In practice, you will use it more this way. ; (ex:ecsel r c) ; sub routine version of ECSEL ; r = row, c = column ; activate cell in active sheet. ; ECPUT - put text value in active cell command ; In practice, you will use it more this way. ; (ex:ecput "textstring") ; sub routine version of ECPUT ; can input any text string in active cell. ; ECGET - get text value in active cell command ; In practice, you will use it more this way. ; (setq aaa (ex:ecget)) ; (princ aaa) ; sub routine version of ECGET (vl-load-com) (defun c:ESCUR ( / *error* excelapp workbooks sheets acsheet sheetnamelist acsheetname selectsheetname sht shlen index hideunhide captionname selectsheetno ) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) ;(princ "\n sheets name list - ") ;(princ sheetnamelist) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (setq hideunhide (vlax-get-property (vlax-get-property sheets 'item (nth index sheetnamelist)) 'visible)) (if (= hideunhide 0) (progn (princ "\n [ Hided ] - ") (princ (nth index sheetnamelist)) ) (progn (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) );end of progn );end of if (setq index (+ index 1)) ) (initget 7) (setq selectsheetno (getint "\n input sheet number - ")) (if (= (vlax-get-property (vlax-get-property sheets 'item (nth (- selectsheetno 1) sheetnamelist)) 'visible) 0) (progn (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (princ "\n selected sheet name - ") (princ (vl-princ-to-string selectsheetname)) (princ "\n cannot select to current sheet, it is hided sheet.") (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n activated sheet name - ") (princ acsheetname) (exit) );end of progn (progn (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (princ "\n selected sheet name - ") (princ (vl-princ-to-string selectsheetname)) (setq sht (vlax-get-property sheets 'Item selectsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n your selected sheet is activated - ") (princ acsheetname) );end of progn );end of if ;(vlax-dump-object acsheet) ;if you delete ";" in first of this line. can get dump vl property of activated sheet you selected (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun ex:ESCUR ( selectsheetno / *error* excelapp workbooks sheets acsheet sheetnamelist acsheetname selectsheetname sht shlen index hideunhide captionname) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) ;(princ "\n sheets name list - ") ;(princ sheetnamelist) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (setq hideunhide (vlax-get-property (vlax-get-property sheets 'item (nth index sheetnamelist)) 'visible)) (if (= hideunhide 0) (progn (princ "\n [ Hided ] - ") (princ (nth index sheetnamelist)) ) (progn (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) );end of progn );end of if (setq index (+ index 1)) ) (if (= (vlax-get-property (vlax-get-property sheets 'item (nth (- selectsheetno 1) sheetnamelist)) 'visible) 0) (progn (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (princ "\n selected sheet name - ") (princ (vl-princ-to-string selectsheetname)) (princ "\n cannot select to current sheet, it is hided sheet.") (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n activated sheet name - ") (princ acsheetname) (exit) );end of progn (progn (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (princ "\n selected sheet name - ") (princ (vl-princ-to-string selectsheetname)) (setq sht (vlax-get-property sheets 'Item selectsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n your selected sheet is activated - ") (princ acsheetname) );end of progn );end of if ;(vlax-dump-object acsheet) ;if you delete ";" in first of this line. can get dump vl property of activated sheet you selected (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun c:ESUHD ( / *error* excelapp workbooks sheets acsheet sheetnamelist acsheetname selectsheetno selectsheetname sht shlen index hideunhide hidecount unhideanswer captionname) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (vlax-put Excelapp "visible" :vlax-true) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) ;(princ "\n sheets name list - ") ;(princ sheetnamelist) (setq shlen (length sheetnamelist)) (setq index 0) (setq hidecount 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (setq hideunhide (vlax-get-property (vlax-get-property sheets 'item (nth index sheetnamelist)) 'visible)) (if (= hideunhide 0) (progn (princ "\n [ Hided ] - ") (princ (nth index sheetnamelist)) (setq hidecount (+ hidecount 1)) ) (progn (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) );end of progn );end of if (setq index (+ index 1)) ) (if (/= hidecount 0) (progn (princ "\n There's ") (princ hidecount) (princ " sheets hided. ") (setq unhideanswer (strcase (getstring "unhide these all sheet? (Y/N) : "))) (cond ((= unhideanswer "Y") (setq index 0) (repeat shlen (setq hideunhide (vlax-get-property (vlax-get-property sheets 'item (nth index sheetnamelist)) 'visible)) (if (= hideunhide 0) (progn (vlax-put-property (vlax-get-property sheets 'item (nth index sheetnamelist)) 'visible -1) (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (princ " - Unhide Complete") ) (progn (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) );end of progn );end of if (setq index (+ index 1)) ); end of repeat ); end of cond option 1 ((/= unhideanswer "Y") (exit)); end of cond option 2 );end of cond );end of progn (progn (princ "\n There's no hided sheets.") );end of progn );end of if ;(vlax-dump-object acsheet) ;if you delete ";" in first of this line. can get dump vl property of activated sheet you selected (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun c:ESADD ( / *error* excelapp workbooks sheets acsheet sheetnamelist acsheetname shlen index selectsheetno selectsheetname sht newsheetname strcasedlist captionname) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (vlax-put Excelapp "visible" :vlax-true) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) ;(princ "\n sheets name list - ") ;(princ sheetnamelist) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) ) (setq strcasedlist (mapcar 'strcase sheetnamelist)) (setq selectsheetno (getstring "\n input order of new sheet (just space bar = add a new sheet at the end) - ")) (cond ((and (/= selectsheetno "") (< (abs (atoi selectsheetno)) (+ shlen 1))) (setq selectsheetno (abs (atoi selectsheetno))) (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (setq sht (vlax-get-property sheets 'Item selectsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq newsheetname (getstring t "\n input new sheet name : ")) (if (/= newsheetname "") (progn (if (= (car (member (strcase newsheetname) strcasedlist)) nil) (vlax-put-property (vlax-invoke-method Sheets 'Add) 'Name newsheetname) (progn (princ "\n cannot make with duplicated name. please retry ") (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n your new sheet is activated - ") (princ acsheetname) (exit) ) );end of if );end of progn );end of if (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) ) (princ "\n") (princ "\n your new sheet is activated - ") (princ acsheetname) (princ "\n") );end of cond option 1 ((and (/= selectsheetno "") (> (abs (atoi selectsheetno)) (+ shlen 1)) ) (princ "\n invalid sheet no. exceed number of sheets") );end of cond option 2 ((or (= selectsheetno "") (= (abs (atoi selectsheetno)) (+ shlen 1))) (setq selectsheetno 1) (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (setq sht (vlax-get-property sheets 'Item selectsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq newsheetname (getstring t "\n Adds a sheet to the last position. \n input new sheet name : ")) (if (/= newsheetname "") (progn (if (= (car (member (strcase newsheetname) strcasedlist)) nil) (vlax-put-property (vlax-invoke-method Sheets 'Add) 'Name newsheetname) (progn (princ "\n cannot make with duplicated name. please retry ") (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n your new sheet is activated - ") (princ acsheetname) (exit) ) );end of if );end of progn );end of if (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq shlen (length sheetnamelist)) (vlax-invoke-method sht 'move (vlax-get-property sheets "item" shlen)) (vlax-invoke-method (vlax-get-property sheets 'item shlen) 'move (vlax-get-property sheets "item" (- shlen 1))) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) ) (princ "\n") (vlax-invoke-method sht 'Activate) (princ "\n your new sheet is activated - ") (princ acsheetname) (princ "\n") );end of cond option 3 );end of cond (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun c:ESDEL ( / *error* myxl excelapp workbooks sheets acsheet sheetnamelist acsheetname selectsheetno selectsheetname sht shlen index captionname) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (vlax-put Excelapp "visible" :vlax-true) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) ;(princ "\n sheets name list - ") ;(princ sheetnamelist) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) );end of repeat (if (< shlen 2) (princ "\n you cannot delete last 1 sheet") (progn (initget 7) (setq selectsheetno (getint "\n input sheet number you want to delete - ")) (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (princ "\n selected sheet name to delete - ") (princ (vl-princ-to-string selectsheetname)) (vlax-for item sheets (if (= (vlax-get-property item 'Name) selectsheetname) (vlax-invoke-method item 'Delete) ) ) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) );end of repeat );end of progn );end of if (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun ex:esadd ( selectsheetno newsheetname / *error* excelapp workbooks sheets acsheet sheetnamelist acsheetname shlen index selectsheetname sht strcasedlist captionname) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (vlax-put Excelapp "visible" :vlax-true) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) ;(princ "\n sheets name list - ") ;(princ sheetnamelist) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) ) (setq strcasedlist (mapcar 'strcase sheetnamelist)) ;(setq selectsheetno (getstring "\n input order of new sheet (just space bar = add a new sheet at the end) - ")) (cond ((and (/= selectsheetno "") (< (abs (atoi selectsheetno)) (+ shlen 1))) (setq selectsheetno (abs (atoi selectsheetno))) (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (setq sht (vlax-get-property sheets 'Item selectsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) ;(setq newsheetname (getstring t "\n input new sheet name : ")) (if (/= newsheetname "") (progn (if (= (car (member (strcase newsheetname) strcasedlist)) nil) (vlax-put-property (vlax-invoke-method Sheets 'Add) 'Name newsheetname) (progn (princ "\n cannot make with duplicated name. please retry ") (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n your new sheet is activated - ") (princ acsheetname) (exit) ) );end of if );end of progn );end of if (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq shlen (length sheetnamelist)) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) ) (princ "\n") (princ "\n your new sheet is activated - ") (princ acsheetname) (princ "\n") );end of cond option 1 ((and (/= selectsheetno "") (> (abs (atoi selectsheetno)) (+ shlen 1)) ) (princ "\n invalid sheet no. exceed number of sheets") );end of cond option 2 ((or (= selectsheetno "") (= (abs (atoi selectsheetno)) (+ shlen 1))) (setq selectsheetno 1) (setq selectsheetname (nth (- selectsheetno 1) SheetNameList)) (setq sht (vlax-get-property sheets 'Item selectsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) ;(setq newsheetname (getstring t "\n Adds a sheet to the last position. \n input new sheet name : ")) (if (/= newsheetname "") (progn (if (= (car (member (strcase newsheetname) strcasedlist)) nil) (vlax-put-property (vlax-invoke-method Sheets 'Add) 'Name newsheetname) (progn (princ "\n cannot make with duplicated name. please retry ") (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n your new sheet is activated - ") (princ acsheetname) (exit) ) );end of if );end of progn );end of if (setq sht (vlax-get-property sheets 'Item newsheetname)) (setq acsheet (vlax-invoke-method sht 'Activate)) (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq shlen (length sheetnamelist)) (vlax-invoke-method sht 'move (vlax-get-property sheets "item" shlen)) (vlax-invoke-method (vlax-get-property sheets 'item (last sheetnamelist)) 'move (vlax-get-property sheets "item" (- shlen 1))) (setq SheetNameList '()) (vlax-for item Sheets (setq SheetNameList (append SheetNameList (list (vla-get-name item)))) ) (setq index 0) (princ "\n [ Number ] - Sheet Name ") (repeat shlen (princ "\n [ ") (princ (+ index 1)) (princ " ] - ") (princ (nth index sheetnamelist)) (setq index (+ index 1)) ) (princ "\n") (vlax-invoke-method sht 'Activate) (princ "\n your new sheet is activated - ") (princ acsheetname) (princ "\n") );end of cond option 3 );end of cond (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun c:ECSEL ( / r c ) (setq r (getint "\n input row number ")) (setq c (getint "\n input column number ")) (ex:ecsel r c) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (princ) ) (defun c:ECPUT ( / textstring) (setq textstring (getstring t "\n input text for selected cell in excel ")) (ex:ecput textstring) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (princ) ) (defun c:ECGET ( / textstring ) (setq textstring (ex:ecget)) (princ "\n your text in excel - ") (princ textstring) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (princ) ) (defun ex:ECSEL ( r c / *error* excelapp workbooks sheets acsheet acsheetname captionname addr rng c1 c2 c3) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (princ "\n active sheet now - ") (princ acsheetname) (princ "\n your selected cell is - Row ") (princ r) (princ ", Column ") (princ c) (setq c (- c 1)) (cond ((and (> c -1) (< c 25)) (setq c1 (+ c 1)) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) );end of cond option 1 ((and (> c 24) (< c 702)) (setq c2 (fix (/ c 26))) (setq c1 (- c (* c2 26))) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) (if (> c2 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) ) );end of cond option 2 ((and (> c 701) (< c 18278)) (setq c3 (fix (/ c (* 26 26)) ) ) (setq c2 (fix (/ (- c (* c3 (* 26 26))) 26))) (setq c1 (- (- c (* (* c3 26) 26)) (* c2 26))) (setq c3 c3) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) ;(princ "c3 - ") ;(princ c3) (if (> c3 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) ) );end of cond option 3 );end of cond (princ " ( in address format ") (princ addr) (princ " )") (setq rng (vlax-get-property acsheet 'Range addr)) (vlax-invoke rng 'Select) (setvar "cmdecho" 1) (princ) ) (defun ex:ECPUT ( textstring / *error* excelapp workbooks sheets acsheet acsheetname accell cell r c captionname addr rng textstring2 textstring c1 c2 c3) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq accell (vlax-get-property ExcelApp 'Activecell)) (setq cell (vlax-get-property acsheet 'Cells)) (setq textstring2 (strcat "'" textstring)) (setq r (vlax-get-property accell 'row)) (setq c (vlax-get-property accell 'column)) (princ "\n active sheet now - ") (princ acsheetname) (princ "\n your selected cell is - Row ") (princ r) (princ ", Column ") (princ c) (setq c (- c 1)) (cond ((and (> c -1) (< c 25)) (setq c1 (+ c 1)) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) );end of cond option 1 ((and (> c 24) (< c 702)) (setq c2 (fix (/ c 26))) (setq c1 (- c (* c2 26))) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) (if (> c2 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) ) );end of cond option 2 ((and (> c 701) (< c 18278)) (setq c3 (fix (/ c (* 26 26)) ) ) (setq c2 (fix (/ (- c (* c3 (* 26 26))) 26))) (setq c1 (- (- c (* (* c3 26) 26)) (* c2 26))) (setq c3 c3) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) ;(princ "c3 - ") ;(princ c3) (if (> c3 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) ) );end of cond option 3 );end of cond (princ " ( in address format ") (princ addr) (princ " )") (princ "\n your text - ") (princ textstring) (setq c (+ c 1)) (vlax-put-property cell 'item r c textstring2) ;(vlax-release-object AcSheet) ;(vlax-release-object Sheets) ;(vlax-release-object Workbooks) ;(vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) (defun ex:ECGET ( / *error* excelapp workbooks sheets acsheet acsheetname accell cell r c captionname addr rng textstring c1 c2 c3 ) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq accell (vlax-get-property ExcelApp 'Activecell)) (setq cell (vlax-get-property acsheet 'Cells)) (setq r (vlax-get-property accell 'row)) (setq c (vlax-get-property accell 'column)) (princ "\n active sheet now - ") (princ acsheetname) (princ "\n your selected cell is - Row ") (princ r) (princ ", Column ") (princ c) (setq c (- c 1)) (cond ((and (> c -1) (< c 25)) (setq c1 (+ c 1)) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) );end of cond option 1 ((and (> c 24) (< c 702)) (setq c2 (fix (/ c 26))) (setq c1 (- c (* c2 26))) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) (if (> c2 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) ) );end of cond option 2 ((and (> c 701) (< c 18278)) (setq c3 (fix (/ c (* 26 26)) ) ) (setq c2 (fix (/ (- c (* c3 (* 26 26))) 26))) (setq c1 (- (- c (* (* c3 26) 26)) (* c2 26))) (setq c3 c3) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) ;(princ "c3 - ") ;(princ c3) (if (> c3 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) ) );end of cond option 3 );end of cond (princ " ( in address format ") (princ addr) (princ " )") (setq c (+ c 1)) ;(setq rng (vlax-get-property acsheet 'Range addr)) ;(vlax-invoke rng 'Select) (setq textstring (vlax-variant-value (vlax-get-property (vlax-variant-value (vlax-get-property cell 'item r c)) 'text))) textstring ) (defun c:ECADR ( / rclist ) (setq rclist (ex:ECADR)) (princ "\n active cell's row and column number by list - ") (princ rclist) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (princ) ) (defun ex:ECADR ( / *error* excelapp workbooks sheets acsheet acsheetname accell cell r c captionname addr rng textstring c1 c2 c3 ) (setvar "cmdecho" 0) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (vlax-release-object AcSheet) (vlax-release-object Sheets) (vlax-release-object Workbooks) (vlax-release-object ExcelApp) (setvar "cmdecho" 1) (princ) ) ;BIGAL's ah:chkexcel (if (= (setq excelapp (vlax-get-object "Excel.Application") ) nil) ; if open already (setq excelapp (vlax-get-or-create-object "Excel.Application")) ) (if (= (setq acsheet (vlax-get-property ExcelApp 'ActiveSheet)) nil) (vlax-invoke-method (vlax-get-property excelapp 'Workbooks) 'Add) ) (vlax-put Excelapp "visible" :vlax-true) (if (/= (setq captionname (vlax-get-property ExcelApp 'caption)) nil) (progn (princ "\n workbook name - ") (princ captionname) );end of progn ) (setq Workbooks (vlax-get-property ExcelApp 'Workbooks)) (setq Sheets (vlax-get-property ExcelApp 'Sheets)) (setq AcSheet (vlax-get-property ExcelApp 'ActiveSheet)) (setq acsheetname (vlax-get-property acsheet 'name)) (setq accell (vlax-get-property ExcelApp 'Activecell)) (setq cell (vlax-get-property acsheet 'Cells)) (setq r (vlax-get-property accell 'row)) (setq c (vlax-get-property accell 'column)) (princ "\n active sheet now - ") (princ acsheetname) (princ "\n your selected cell is - Row ") (princ r) (princ ", Column ") (princ c) (setq c (- c 1)) (cond ((and (> c -1) (< c 25)) (setq c1 (+ c 1)) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) );end of cond option 1 ((and (> c 24) (< c 702)) (setq c2 (fix (/ c 26))) (setq c1 (- c (* c2 26))) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) (if (> c2 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) ) );end of cond option 2 ((and (> c 701) (< c 18278)) (setq c3 (fix (/ c (* 26 26)) ) ) (setq c2 (fix (/ (- c (* c3 (* 26 26))) 26))) (setq c1 (- (- c (* (* c3 26) 26)) (* c2 26))) (setq c3 c3) (setq c2 c2) (setq c1 (+ c1 1)) ;(princ "c1 - ") ;(princ c1) ;(princ "c2 - ") ;(princ c2) ;(princ "c3 - ") ;(princ c3) (if (> c3 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) ) );end of cond option 3 );end of cond (princ " ( in address format ") (princ addr) (princ " )") (setq c (+ c 1)) ;(setq rng (vlax-get-property acsheet 'Range addr)) ;(vlax-invoke rng 'Select) (list r c) ) (princ "\n ESCUR, ESADD, ESDEL, ESUHD / ECSEL, ECPUT, ECGET, ECADR- loading complete") There are many existing lisp that do this, but I made it easy for newbies like me to understand. by command It's also for my practice. command : - for SHEET 1. ESCUR - change current Excel sheet (ex:escur num) ; sub routine version of ESCUR 2. ESADD - add new Excel sheet (ex:esadd "numstring" "namestring") ; sub routine version of ESADD 3. ESDEL - delete Excel sheet 4. ESUHD - unhide all hided sheets at once - for CELL 5. ECSEL - select active cell (ex:ecsel row column) ; sub routine version of ECSEL 6. ECPUT - put text value in active cell (ex:ecput "textstring") ; sub routine version of ECPUT 7. ECGET - get text value in active cell, and also get address of active cell (setq aaa (ex:ecget)) ; sub routine version of ECGET 8. ECADR - get active cell's address by list (r c) (setq rclist (ex:ecadr)) ; sub routine version of ECADR example command: ESADD active sheet now - Sheet2 [ Number ] - Sheet Name [ 1 ] - Sheet1 [ 2 ] - Sheet2 input order of new sheet (just space bar = add a new sheet at the end) - input new sheet name : TEST_EKKO [ Number ] - Sheet Name [ 1 ] - Sheet1 [ 2 ] - Sheet2 [ 3 ] - TEST_EKKO your new sheet is activated - TEST_EKKO command: ESADD active sheet now - TEST_EKKO [ Number ] - Sheet Name [ 1 ] - Sheet1 [ 2 ] - Sheet2 [ 3 ] - TEST_EKKO input order of new sheet (just space bar = add a new sheet at the end) - 3 input new sheet name : TEST2_EKKO [ Number ] - Sheet Name [ 1 ] - Sheet1 [ 2 ] - Sheet2 [ 3 ] - TEST2_EKKO [ 4 ] - TEST_EKKO your new sheet is activated - TEST2_EKKO not only variable, but also, in excel, you can see active sheet is changed. since this Lisp is made to work with the sheet order number 'selectsheetno' it will be easy to paste into your other Lisp routine's loop if you paste only the active cell part well, you can apply this to the previous post, screenshot Lisp (ssw, ssp) edit history + update ESDEL function. and add BIGAL's code + ESADD : add escape when duplicated sheet name + ESADD : if duplicated sheet name, activate that sheet + add (ex:esaddmodule) + ESCUR : add cannot select hided sheet option + ESUHD : add function - unhide all hided sheets at once + ALL : add function - make new workbooks when excel is not opened, add release excel routine, print workbook name (caption) + ECSEL, ECPUT, ECGET - add cell function for select, put text, get text. command is for example. sub routine is main. + ECSEL, ECPUT, ECGET - add address calculation for over the Z column, ZZ column. now it will be calculate correctly in case of address under ZZZ column. + ECSEL, ECPUT, ECGET - edit address calculation. + ECADR - add function. + ECSEL, ECPUT, ECGET, ECADR - edit typo this part ((and (> c -1) (< c 25)) (setq addr (strcat (chr (+ 64 c)) (itoa r) ":" (chr (+ 64 c)) (itoa r) )) );end of cond option 1 to ((and (> c -1) (< c 25)) (setq c1 (+ c 1)) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) );end of cond option 1 + ESCUR - edit typo, separate c:ESCUR and ex:ESCUR + ESADD - When the current number of sheets+1 number is entered, the sheet is added at the last position. 2022.06.07 edit add 2 ifs (if (> c2 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (chr (+ 64 c1)) (itoa r) ":" (chr (+ 64 c1)) (itoa r) )) ) ;;;;;;;;;;;;;;; (if (> c3 0) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c3))) (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) (setq addr (strcat (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r) ":" (vl-princ-to-string (chr (+ 64 c2))) (vl-princ-to-string (chr (+ 64 c1))) (itoa r))) )
    1 point
  5. Don't you have to have AutoDesk TrueView installed as well?
    1 point
  6. (defun average ( lst ) (mapcar '(lambda ( x ) (/ x (length lst))) (apply 'mapcar (cons '+ lst))) ) (average '((0.0 1.0 2.0 3.0) (1.0 2.0 3.0 4.0) (2.0 3.0 4.0 5.0) (3.0 4.0 5.0 6.0))) ;; => (1.5 2.5 3.5 4.5)
    1 point
×
×
  • Create New...