Skip to content

Commit

Permalink
closes #998
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein committed Nov 29, 2018
1 parent bc20d60 commit f01d1d3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
Binary file modified xlwings/tests/udfs/async_tests.xlsm
Binary file not shown.
Binary file modified xlwings/tests/udfs/dynamic_array_tests.xlsm
Binary file not shown.
5 changes: 5 additions & 0 deletions xlwings/tests/udfs/udf_tests.py
Expand Up @@ -716,5 +716,10 @@ def method_signature_with_more_than_1024_characters(
return 'splitted signature'


@xw.sub
def mysub(x):
wb = xw.Book.caller()
wb.sheets['Sub'].range('A3').value = x

if __name__ == "__main__":
xw.serve()
Binary file modified xlwings/tests/udfs/udf_tests.xlsm
Binary file not shown.
4 changes: 2 additions & 2 deletions xlwings/udfs.py
Expand Up @@ -7,7 +7,7 @@
from importlib import import_module
from threading import Thread

from win32com.client import Dispatch
from win32com.client import Dispatch, CDispatch

from . import conversion, xlplatform, Range, apps, PY3
from .utils import VBAWriter
Expand Down Expand Up @@ -241,7 +241,7 @@ def call_udf(module_name, func_name, args, this_workbook=None, caller=None):

module = get_udf_module(module_name)
func = getattr(module, func_name)
if caller:
if caller and isinstance(caller, CDispatch): # currently, cache is only used if caller is Range
xw_caller = Range(impl=xlplatform.Range(xl=caller))
cache_key = (func.__name__ + str(args) + str(xw_caller.sheet.book.app.pid) +
xw_caller.sheet.book.name + xw_caller.sheet.name + xw_caller.address.split(':')[0])
Expand Down

0 comments on commit f01d1d3

Please sign in to comment.