Module Name
Description
RequirementsTemplate.docx

Requirements Template

A general documents with areas to describe various facets of requirements analysis
OfficeJavascriptLibrary.png

JavaScript API for Office (PNG)

The JavaScript API for Office includes objects, methods, properties, events, and enumerations that you can use in your apps for Office code.

The Microsoft.Office.WebExtension namespace (which by default is referenced using the alias Office in code) contains objects you can use to write script that interacts with content in Office documents, worksheets, presentations, mail items, and projects from your apps for Office.
SecondaryAxisAlignment_VB.txt

Align Secondary Axis (VB.NET)

The general algorithm used for aligning a chart's secondary axis with the primary axis:
  1. Get primary divisors
  2. Get upper and lower bounds of secondary
  3. Get larger ABS(max) or ABS(min)
  4. Multiply (max/min) divisor by numbers (1,2,5,10,20,25,30) to find the first multiplier larger than current
  5. Apply multiplier to major unit
  6. Apply min to min (min divisors x minor unit)
  7. Apply max to max (max divisors x major unit)
SecondaryAxisAlignment_C#.txt

Align Secondary Axis (C#)

The general algorithm used for aligning a chart's secondary axis with the primary axis:
  1. Get primary divisors
  2. Get upper and lower bounds of secondary
  3. Get larger ABS(max) or ABS(min)
  4. Multiply (max/min) divisor by numbers (1,2,5,10,20,25,30) to find the first multiplier larger than current
  5. Apply multiplier to major unit
  6. Apply min to min (min divisors x minor unit)
  7. Apply max to max (max divisors x major unit)
GetFileInfo.ps1

Get File Owner with PowerShell

A basic script to derive the owner of a file using, along with othe rinformation
SQLExecution_20140522-01.zip

SQL Execution Add-In for Excel (C# + Facade for VBA)

A C# library that simplifies some aspects of connecting to Db's and running SQL statements in a threaded manner. The C# code can also be exposed to Excel VBA, enabling it to simultaneously execute numerous SQL statements, something that cannot normally be done in VBA.
VSTO.cs

Workbook Close Event Capture

For anyone that has had to capture the WorkbookBeforeClose event and struggled with the imperfectness of the process, this is C# code that fires only if the workbook is completely closed.

Kudos to the developer; Wordpress entry is here.
CreateNamedRange.txt

Create Named Range (Excel / C#)

When creating pivot tables and charts, Excel's default is to base it on a fixed range, not on one that expands. This code generates a named range that is dynamically expanding in both the row and column dimensions, using the Offset function, useful in pivot tables and charts where the data will be updated and will likely expand beyond the original size.
CustomXmlHandler_20131024-01.zip

Working with CustomXmlPart (C#)

This C# code shows the basics of working with CustomXmlParts of the Office 2007 and greater environment. It is a way to store complex information within workbooks. In this example, I create a type, and the create XML to stores the type, and then either set, or retrieve the XML.
CustomXml.txt

Working with CustomXmlPart (VBA)

This code shows the basics of working with CustomXmlPart of the Office 2007 and greater environment. It is a way to store complex information within workbooks. In this example, I create a type, and the create XML to stores the type, and then either set, or retrieve the XML.
DotNETProgrammingStandards.xlsx

.Net Programming Standards and Conventions

An Excel file displaying .NET programming standards and conventions
Composite.cs

Composite Pattern

A implementation of the composite pattern similar to a class that would be used for constructing a binary search tree. Better, more detailed implementations are known as red-black or AVL trees.

Salient Characteristic(s)
Builder.cs

Builder Pattern

Below is a fairly straightforward 'fill-in-the-blanks' example of a Builder design pattern:

Salient Characteristic(s)
FacadeForVBA.cs

Facade Pattern (VBA to .NET)

This is code possible through .NET, in that it bridges across to COM for automation in VBA. This concept can be extended to work for many other COM-based applications. This code allows the add-in to expose internal .NET-coded procedures to Excel COM, extending the use of the .NET code.

Salient Characteristic(s)
ISubscriberFacade.cs

Facade Pattern (Example)

This is derived from actual code of mine, and elements of this sample combine the Facade pattern with the Publisher (Observer) pattern. The primary class, based on the ISubscriber interface, is fairly complicated to use, requiring delegates, threading, and asynchronous callbacks. The facade, based on ISubscriberFacade, encapsulates all the methods required to work with the Windows Communication Foundation (WCF) service , handling threading, delegate creation, and asynchronous callbacks internally, so that that the clients only need to create the object. I wrote the encapsulating client to ease the adoption of the WCF service for legacy clients, seeing that the code complexity was likely a hurdle.

Salient Characteristic(s)
Notes
Multiton.cs

Multiton Pattern (Example)

A fairly simple example of the multiton pattern, with a private constructor, and a tracker for created objects, the name being an integer identifier.

Salient Chacteristic(s)
Prototype.cs

Prototype Pattern (Example)

Whereas ICloneable will be used to return a shallow copy, the data object's attribute Serializable enables creation of a deep copy of the data object, instead of a reference:

Salient Chacteristic(s)
LazyInitialization.cs

Lazy Initialization Pattern (Example)

A fairly straightforward 'fill-in-the-blanks' example of a Lazy Initialization design pattern, except that this uses an enumeration for the type - I hate passing strings, so easy to screw up - as well as a struct for the type that is lazily initialized.
FactoryMethod.txt

Factory Method Pattern (Example)

Following is an example of the Factory Method. In this case, a method call sets and returns the type. Also, pardon the values set as field, rather than as properties, but this is a simple example, rather than a full implementation.

Salient Point(s)
Bridge.txt

Bridge or Adapter Pattern (Example)

A bare-bones, generic implementation of the bridge pattern, using inheritance, polymorphism, and abstraction.

Salient Characteristic(s)
AbstractFactoryExample.cs

Abstract Factory Pattern (Example)

My work requires working with Windows Communication Foundation (WCF) services daily, and I typically have two (2) types of clients, either Excel, which is the largest part of my user base, or external applications, usually server-based. This example uses the idea of two (2) client types, each requiring a different host/port combination, which the abstract factory pattern will return.

Salient Characteristic(s)
Singleton_CSharp.txt

Singleton Pattern (Example)

The Singleton design pattern seems generally frowned upon, except for use in logging classes. Below are several variants of the Singleton design pattern, of which, only the thread-safe version merits attention:

Salient Characteristic(s)
PowerRelatedCode.txt

Power Code - Handle Sleep & Suspension

Excel C# code to reload an Excel add-in, although this should work for any office product, upon waking from suspend on Windows 7
DispatchingObservableCollection.zip

Dispatching Observable Collection

Working with WPF and ObservableCollection using threads, one will run into the problem whereby you cannot update an ObservableCollection from outside the owning thread; Delegates and Invoke will not work. A solution is to inherit and expand the class, as is done in this example on michIG's Blog

The attached file contains the original code in C#, as well as code converted to VB.NET.
EulerLib.fs

Various Number Functions (F#)

A collection of basic mathematical functions written in F# as part of my learning via Project Euler. This module has functions for creating arrays or calculating values for the following:
Stat.fs

Basic Statistical Functions (F#)

A very basic F# class for performaing standard deviation and variance calculations.
CompetencyMatrix.xlsx

Competency Matrix for VBA

A developer, Sijin Joseph, reachable @ http://www.indiangeek.net/, has an online Programmer Competency Matrix, which I have taken and converted to Excel.
COMReusable_20101111-01.zip

C# Add-in for VBA via COM

A C# project that can be used to expose methods to VBA via COM automation:

The project includes multiple methods:

C-Sharp form, printing and formatting options C-Sharp OLAP connection-related methods C-Sharp refresh pivot methods The project implements one form for printing, but otherwise has no UI. Included is a text file showing how to access and execute the methods via VBA.

This is an update C# add-in that exposes static methods using Excel-dna.
ThreadArray_C#.txt

Thread Array for Command Pattern

A thread array, that provides several ways to execute a collection of threaded objects
Typical properties/parameters
GettingSMTPAddresesFromOutlook_C#.txt

SMTP Addreses from Outlook (C#)

This is C# WinForm code that demonstrates using Outlook (requires a third-party COM product called Redemption) to get at the SMTP addresses from the outlook address book. It takes about 60 minutes to output a file, also attached, of ~160k users and their SMTP address, but it shows the basics of the process. This is not likely appropriate for server use. Below is the code, but an easier solution might simply be for the code sending the email to iterate through the list and send an email to each person, and record failure for any particular address
Excel_COM_MemoryCleanup_C#.txt

VSTO (C#) COM Memory Cleanup

Two examples (one works on the workbook's pivot caches, the other is on a single instance of a pivot) of working through Excel and cleanup
COM_MemoryCleanup_C#.txt

COM Memory Cleanup for Office Interop (C#)

Helper code for cleanining up memory when working with Excel in .NET (COM Object)
DesignPatterns.xlsx

Design Pattern List (Updated)

An updated list of design patterns covering ideas laid out by the GoF, Code Complete, Pattern-Oriented Software Architecture, and Patterns of Enterprise Application Architecture.
NETNamingConventions.xlsx

Naming Conventions for .NET

Naming conventions for the .NET platform, a cleaner version of a previous file.
C#_CellsetToPivotTable.txt

CellSet, DataTable, Recordset Conversion (C#)

This C# code that generates a cellset from MDX, transforms it into a datatable, tranforms that into an ADODB recordset, and then creates a pivotcache/pivottable from the recordset. It gets around the inability of Excel 2003/2007 to create pivot tables directly from MDX.
C#_HyperlinkAdd.txt

Inserting Hyperlinks (C#)

Code for inserting hyperlinks. This was initially designed to work from a ribbon, which finds the selected cell(s) and passes that to the methods to insert hyperlinks.
VB_LogViewer_WebService.txt

An example of web service code to return log data.
VB_LoggingClass.txt

A 'naive' implementation of a logging class for ASP.NET and SQL Server. By naive, I mean that I wrote it when first starting out, so the code likely violates some basic design tenets.
VB_GenericDataReader.txt

VB.NET class for doing generic data reads, encapsulating redundant connection.reader code.
C#_JoinMDX_SQL_Results.txt

An example of how join MDX and SQL results using relations in C#
DesignPatterns.zip

Design Patterns