![File File](/uploads/1/2/5/5/125597853/251688837.png)
I'm using Office 2011-Excel on a Mac running Mountain Lion. My.xlam file is saved in the correct folder Applications/Microsoft Office 2011/Office/Add-Ins. I've installed it correctly using the Tools/Add-Ins menu. My code is in the This Worksheet section of the.xlam file. My Add-In's source code is viewable from all documents. My code as follows. An add-in file is an Excel file that contains macros (code) and has the extension “.xla” or “.xlam” (2007 and later). When opened, the worksheets in the file are hidden and the macros are typically accessed through buttons that are added to the toolbar or ribbon.
Installation To install the add-in, it’s easiest to use the command line client: xlwings addin install. Technically, this copies the add-in from Python’s installation directory to Excel’s XLSTART folder. If you encounter issues, then you can also download the add-in ( xlwings.xlam) from the (make sure you download the same version as the version of the Python package). Once downloaded, you can install the add-in by going to Developer Excel Add-in Browse. If you don’t see Developer as tab in your ribbon, make sure to activate the tab first under File Options Customize Ribbon (Mac: Cmd +Ribbon & Toolbar). Then, to use RunPython or UDFs in a workbook, you need to set a reference to xlwings in the VBA editor, see screenshot (Windows: Tools References., Mac: it’s on the lower left corner of the VBA editor). Note that when you create a workbook via xlwings quickstart, the reference is already set.
Global Settings While the defaults will often work out-of-the box, you can change the global settings directly in the add-in:. Interpreter: This is the path to the Python interpreter (works also with virtual or conda envs), e.g. 'C: Python35 pythonw.exe' or '/usr/local/bin/python3.5'.
An empty field defaults to pythonw that expects the interpreter to be set in the PATH on Windows or.bashprofile on Mac. PYTHONPATH: If the source file of your code is not found, add the path here. UDFMODULES: Names of Python modules (without.py extension) from which the UDFs are being imported. Separate multiple modules by “;”. Example: UDFMODULES = 'commonudfs;myproject' The default imports a file in the same directory as the Excel spreadsheet with the same name but ending in.py. Debug UDFs: Check this box if you want to run the xlwings COM server manually for debugging, see.
Log File: Leave empty for default location (see below) or provide the full path, e.g. RunPython: Use UDF Server: Uses the same COM Server for RunPython as for UDFs. This will be faster, as the interpreter doesn’t shut down after each call. Restart UDF Server: This shuts down the UDF Server/Python interpreter. It’ll be restarted upon the next function call.
Can't open a.xlam file? If you want to open a.xlam file on your computer, you just need to have the appropriate program installed. If the.xlam association isn't set correctly, you may receive the following error message: Windows can't open this file: File: example.xlam To open this file, Windows needs to know what program you want to use to open it.
![.xlam File In Excel 2011 For Mac .xlam File In Excel 2011 For Mac](http://www.begraphic.com/sites/default/files/P&L.gif)
Windows can go online to look it up automatically, or you can manually select from a list of programs that are installed on your computer. To change file associations:. Right-click a file with the extension whose association you want to change, and then click Open With. In the Open With dialog box, click the program whith which you want the file to open, or click Browse to locate the program that you want. Select the Always use the selected program to open this kind of file check box.