Created
January 21, 2013 00:54
-
-
Save mathias-brandewinder/4582881 to your computer and use it in GitHub Desktop.
Attach to running Excel instance in F# and write to a Worksheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "office.dll" | |
#r "Microsoft.Office.Interop.Excel" | |
open Microsoft.Office.Interop.Excel | |
open System.Runtime.InteropServices | |
let xl = Marshal.GetActiveObject("Excel.Application") :?> Microsoft.Office.Interop.Excel.Application | |
let wbs = xl.Workbooks | |
let wb = wbs.[1] | |
let sh = wb.Worksheets.[1] :?> Worksheet | |
sh.Cells.[1,1] <- "Hello from F#!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment