Getting Started

Compatible with Office 365.


Visual Studio 2022

Downlod the SDK to the following folder: C:\XLL\
Create a new project
language - C++, platform - Windows, project - Library
Dynamic Link Library (DLL)
Enter a project name and place the solution and project in the same folder


Precompiled Headers

Switch off precompiled headers.
Change the project properties and add this folder.

Configuration Properties > C/C++ > Precompiled Headers 
Precompiled Header - Not Using Precompiled Headers
Precompiled Header File - (blank)

xlcall.h

This file is part of the Excel 2013 SDK.
This is a header file that contains all the necessary data structures, constant definitions and enumerations that are used by Excel.
It also contains all the C API interface functions that are needed for information to pass between Excel and the DLL.
We don't need to add this file to the actual project we just need to be able to link to this file.
This file is linked at compile time and the code is embedded into your solution.
Change the project properties and add this folder.

Configuration Properties > C/C++ > General 
Additional Include Directories - C:\XLL\Excel2013XLLSDK\Include\

(do not use VC++ Directories > Include Directories)


xlcall32.lib

This file is part of the Excel 2013 SDK.
This is a static import library that contains all the symbol definitions and function declarations that are implemented in the xlcall32.dll
We don't need to add this file to the actual project we just need to be able to link to this file.
This file is linked at compile time and the code is embedded into your solution.
Change the project properties and add this folder.

Configuration Properties > Linker > General 
Additional Library Directories - C:\XLL\Excel2013XLLSDK\LIB\x64\

(do not use VC++ Directories > Library Directories)


xlcall.cpp

This file is part of the Excel 2013 SDK.
This is a source file that contains the code for the Excel12() and Excel12v() functions.
This file is necessary because these two functions are not exported by the xlcall32.lib or xlcall32.dll files.
This file needs to be added to your project and is therefore dynamically linked to the Excel callback.
Copy the following file:

C:\XLL\Excel2013XLLSDK\SRC\xlcall.cpp 

Paste this file into the project folder and add this file to the project (Project > Add Existing Item).

C:\Users\"username"\source\repos\"myprojectname"\xlcall.cpp 

example.c

This file is part of the Excel 2013 SDK.
This is a source file that contains ??
Copy the following file:

C:\XLL\Excel2013XLLSDK\Samples\example\example.c 

Paste this file into the project folder and add this file to the project (Project > Add Existing Item).

C:\Users\"username"\source\repos\"myprojectname"\example.c 

Change the angle brackets and replace them with quotes - ??

#include <framewrk.h> 
#include "framewrk.h"

example.c - xlAutoOpen

Change the following function so it only registers the function called "CalcCircum".

__declspec(dllexport) int WINAPI xlAutoOpen(void) 
{
  XLOPER12 xDLL;

/* Get the XLL filename */
  Excel12f(xlGetName, &xDLL, 0);

  Excel12f(xlfRegister, 0, 4,
          (LPXLOPER12)&xDLL,
          (LPXLOPER12)TempStr12(L"CalcCircum"),
          (LPXLOPER12)TempStr12(L"BB"),
          (LPXLOPER12)TempStr12(L"CalcCircum"));

/* Free the XLL filename */
   Excel12f(xlFree, 0, 1, (LPXLOPER12)&xDLL);

/* Display a dialog box indicating that the XLL was successfully added */
   XCHAR szBuf[255];
   wsprintfW((LPWSTR)szBuf, L"xlAutoOpen has run successfully");
   Excel12f(xlcAlert, 0, 2, TempStr12(szBuf), TempInt12(2));

   return 1;
}

example.c - CalcCircum

This file includes the definition of the CalcCircum function at the bottom of the example.c file.

__declspec(dllexport) double WINAPI CalcCircum(double pdRadius) 
{
   return pdRadius * 6.283185308;
}

example.def

Copy the following file:

C:\XLL\Excel2013XLLSDK\Samples\example\EXAMPLE.DEF 

Paste this file into the project folder, change it to lowercase and add this file to the project (Project > Add Existing Item).

C:\Users\"username"\source\repos\"myprojectname"\example.def 

Change the project properties and add the module definition file

Configuration Properties > Linker > Input 
Module Definition File = example.def

framewrk.c

Copy the following file and paste them into the project folder

C:\XLL\Excel2013XLLSDK\SAMPLES\FRAMEWRK\FRAMEWRK.h 

Add the following existing item to the project.

C:\Users\"username"\source\repos\"myprojectname"\ 

Comment out this header from the top of the file.

'#include <xlcall.cpp>

Change the angle brackets and replace them with quotes

#include <framewrk.h> 
#include "framewrk.h"

Change the angle brackets and replace them with quotes

#include <memorymanager.h> 
#include "memorymanager.h"

On line 252 change the "Excel4v" reference to "Excel12v".

xlret = Excel12v(xlfn,pxResult,count,(LPXLOPER *)ppxArgs); 

On line 991 change the "Excel4v" reference to "Excel12v".

wRet = Excel4(xlSheetId, lpx, 0); 

Add Files

C:\XLL\Excel2013XLLSDK\SAMPLES\FRAMEWRK\FRAMEWRK.h 
C:\XLL\Excel2013XLLSDK\SAMPLES\FRAMEWRK\MemoryManager.h
C:\XLL\Excel2013XLLSDK\SAMPLES\FRAMEWRK\MemoryManager.cpp
C:\XLL\Excel2013XLLSDK\SAMPLES\FRAMEWRK\MemoryPool.h
C:\XLL\Excel2013XLLSDK\SAMPLES\FRAMEWRK\MemoryPool.cpp

Add the following existing items to the project.

C:\Users\"username"\source\repos\"myprojectname"\ 

Remove Files

Remove the following files from the project:

framework.h 
pch.h
dllmain.cpp
pch.cpp

Target File Extension

Change the target file extension from ".dll" to ".xll".

Project Properties > Configuration Properties > Advanced 
Target File Extension = .xll

Build Solution

Check the selected platform
Build > Configuration Manager
Active solution platform = x64
Select (Build > Build Solution)


Loading in Excel

Project Properties > Configuration Properties > Debugging 
Command = C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE

In Excel type ="CalcCircum(12)" into a cell



© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrevNext