Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing a workbook as an argument in macro call #784

BricksBurg opened this Issue Dec 6, 2017 · 3 comments


None yet
3 participants
Copy link

BricksBurg commented Dec 6, 2017

I am trying to call an external macro in a workbook which requires the workbook as a parameter although I get the following error:
"TypeError: Objects of type 'Book' can not be converted to a COM VARIANT (but obtaining the buffer() of this object could)"

Here is the code:
import xlwings as xw
wb = xw.Book(FILEPATH)
macro1 ="libraryfunctions.xlam!Function1")


This comment has been minimized.

Copy link

fzumstein commented Dec 6, 2017

can you paste the function definition of Function1?


This comment has been minimized.

Copy link

BricksBurg commented Dec 6, 2017

Sure it's:
Public Function Function1(oWorkbook As Workbook) As Boolean


This comment has been minimized.

Copy link

skasi7 commented Jan 29, 2018

A wild guess, check if passing wb.api instead of wb fixes your problem. Maybe wb.api can be passed as COM VARIANT.

@fzumstein fzumstein added this to the 0.15.5 milestone Mar 25, 2019

@fzumstein fzumstein closed this in 9987daa Mar 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.