In this Walkthrough we will create a workbook customization. Such customization is embedded in a workbook and does not require FCell installation to run, only Excel and .NET are required.

Create Excel workbook with embedded FCell runtime

  • Click on New Doc in FCell Ribbon:

    New Doc

    You can use an existing workbook as a template or create a blank workbook. If you choose a template, a copy of the workbook will be used.

    Note

    Once you embed FCell runtime in a workbook you will not have access to its VBA Project and any existing VBA code will be removed.

    Note

    You can embed FCell runtime for 32 bit Excel, 64 bit Excel or both. Each runtime will add ca 1.5MB to your workbook.

Embed .NET customization assemblies in a workbook with embedded FCell runtime

Go to FCell Ribbon and click on Doc .NET AddIn

  1. Go to FCell Ribbon

    FCell Menu
  2. Open Doc .NET AddIn

    Workbook Customization Empty
  3. Add one or more assemblies which define your workbook customization to Customization list. Add supporting assemblies to References list

    Optionally add static methods marked with [XlWorkbookOpen] and [XlWorkbookClose] to your customization assemblies. These methods will run when your workbook opens/closes:

    F# Copy imageCopy
    open FCell.ManagedXll
    
    module XlWorkbookEvents
    [<XlWorkbookOpen>]
    let workbookOpen () = MessageBox.Show("Workbook open")
    [<XlWorkbookClose>]
    let workbookClose () = MessageBox.Show("Workbook close")
    C# Copy imageCopy
    using FCell.ManagedXll;
    
    public class XlWorkbookEvents
    {
        [XlWorkbookOpen]
        public static void WorkbookOpen() 
        {
            MessageBox.Show("Workbook open");
        }
        [XlWorkbookClose]
        public static void WorkbookClose() 
        {
            MessageBox.Show("Workbook close");
        }
    }
    Visual Basic Copy imageCopy
    Imports FCell.ManagedXll
    
    Public Class XlWorkbookEvents
    
        <XlWorkbookOpen>
        Public Shared Sub WorkbookOpen()
            MessageBox.Show("Workbook open")
        End Sub
        Public Shared Sub WorkbookClose()
            MessageBox.Show("Workbook close")
        End Sub
    End Class
    Note

    You can see how to create assembly with UDFs here and assembly with Ribbon and Task Pane here.

    Optionally enter FCell runtime license key (leave blank for free 30 day trial). The runtime license key will allow the workbook customization to run only on limited number of computers

    Workbook Customization With Data
  4. Click Save and you should see your customization immediately. The workbook will load its customization (UDFs, Ribbons etc) on startup even if FCell is not installed on the machine.