In the vlxls Project, there are some functions using msxl-get-ActiveSheet function. But since the latest version of excel is 2016, and when i debug, it reminds that the msxl-get-ActiveSheet function is not available. Here's the question—How to get the current worksheet,instead of using the function.
The project official site is http://www.atablex.com/htmls/vlxls-functions.htm. But now it has gone.
Many years ago, I have abandened atablex.com.
If you want to continue using the lagacy codes with msxl-* functions, you will need first to import them into AutoCAD by calling the function:
(/ OSVar GGG Olb8 Olb9 Olb10 TLB Out msg msg1 msg2)
(setq msg
"\n Initializing Microsoft Excel " msg1 "\042Initialization Error\042"
"\042 WARNING" "\n ======="
"\n Can NOT detect Excel97/200X/XP in your computer"
"\n If you already have Excel installed, please email"
"\n us to get more solution via kozmosovia@hotmail.com\042")
)
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Excel.EXE"
"Path"
)
)
)
"WINBOOTDIR" "SYSTEMDRIVE"
"USERNAME" "COMPUTERNAME"
"HOMEDRIVE" "HOMEPATH"
"PROGRAMFILES"
)
GGG
)
)
)
)
)
)
(vl
-string
-subst "EXCEL10.OLB" "EXCEL.EXE" GGG
) )
)
"OFFICE12"
)
Out "2007"
)
)
"OFFICE11"
)
Out "2003"
)
)
"OFFICE10"
)
Out "XP"
)
)
(Olb9
Out "2000"
)
)
(Olb8
Out "97"
)
)
(t
(setq Out
"Version Unknown")) )
:tlb-filename TLB :methods-prefix
"msxl-" :properties-prefix
"msxl-" :constants-prefix "msxl-"
)
)
)
)
(vldcl-msgbox "x" msg1 msg2)
)
)
)
)
msxl-xl24HourClock
)
This is lagacy code which worked with very old Excel versions such as Excel XP, for new Excel version, the TLB file is the Excel.EXE. You can simply allocate the path of Excel.EXE and call (vlax-import-type-library
:tlb-filename EXCEL.EXEFilePath :methods-prefix
"msxl-" :properties-prefix
"msxl-" :constants-prefix "msxl-"
) to have the msxl functions imported.
However, this import will bring nearly thousand msxl- functions into AutoCAD but you may only need few of them. As an alternative, you can simply use vlax-get-property and vlax-invoke to only call the Excel methods and properties you need, just as ahsattarian's codes.
(msxl-get-activesheet vlobj) equals to (vlax-get-property vlobj "activeSheet")