PyXLL exposes certain functions from the Excel C API. These mostly should only be called from a worksheet, menu or macro functions, and some should only be called from macro-sheet equivalent functions [1].
Functions that can only be called from a macro or menu can be called from elsewhere using
schedule_call
. This allows these C API functions to be called as schedule_call
schedules a function call on Excel’s main thread and in a macro context.
xlfVolatile
(volatile)Parameters: | volatile (bool) – boolean indicating whether the calling function is volatile or not. |
---|
Usually it is better to declare a function as volatile via the xl_func
decorator.
This function can be used to make a function behave as a volatile or non-volatile function
regardless of how it was declared, which can be useful in some cases.
Callable from a macro equivalent function only [1]
xlcAlert
(alert)Pops up an alert window.
Callable from a macro or menu function only [2]
Parameters: | alert (string) – text to display |
---|
xlcCalculation
(calc_type)set the calculation type to automatic or manual.
Callable from a macro or menu function only [2]
Parameters: | calc_type (int) –
or or |
---|
xlCalculationAutomatic = 1
xlCalculationSemiAutomatic = 2
xlCalculationManual = 3
xlcCalculateNow
()recalculate all cells that have been marked as dirty (i.e. have dependencies that have changed) or that are volatile functions.
Equivalent to pressing F9.
Callable from a macro or menu function only [2]
xlcCalculateDocument
()recalculate all cells that have been marked as dirty (i.e. have dependencies that have changed) or that are volatile functions for the current worksheet only
Callable from a macro or menu function only [2]
xlAsyncReturn
(handle, value)Used by asynchronous functions to return the result to Excel see Asynchronous Functions
This function can be called from any thread and doesn’t have to be from a macro sheet equivalent function
Parameters: |
|
---|
xlAbort
(retain=True)Yields the processor to other tasks in the system and checks whether the user has pressed ESC to cancel a macro or workbook recalculation.
Parameters: | retain (bool) – If False and a break condition has been set it is reset, otherwise don’t change the break condition. |
---|---|
Returns: | True if the user has pressed ESC, False otherwise. |
xlSheetNm
(sheet_id)Returns: | sheet name from a sheet id (as returned by xlSheetId or XLCell.sheet_id ). |
---|
xlfGetDocument
(arg_num[, name])Parameters: |
|
---|---|
Returns: | depends on arg_num |
Footnotes
[1] | (1, 2, 3) A macro sheet equivalent function is a function exposed using xl_func with macro=True. |
[2] | (1, 2, 3, 4) Some Excel functions can only be called from a macro or menu. To call them from another context use
async_call . |