开发者

F#, problems with IntelliSense and Office

I'm trying to write some Office automation code and I cannot get IntelliSense help for the PIA Office types. The strange thing is that it works fine in C# and also in the Tutorial.vs2010 F# Solution with some of the same co开发者_JS百科de.

I'm using VS10 and PIA for Office 14.

F#, problems with IntelliSense and Office

VS

F#, problems with IntelliSense and Office

Any ideas?


I forgot to include a reference to Office.dll. That appeared to fix the issue.


For anyone finding this later, but can't figure out where office.dll is, like I did. I faced the same Issue with F# 4.0, Office 2013, and VS Community 2015 Update 2.0

I typed this in the beginning of the file to get Intellisense working, no need to search for office.dll in your machine:

#r "office, Version = 15.0.0.0"

This is the same text it gives you with <Note>, but without the Culture=neutral and PublicKey=w/e. Seems to work flawlessly.

For context, this is how my file starts:

#r "Microsoft.Office.Interop.Excel"
#r "office, Version = 15.0.0.0"


open System
open System.IO
open System.Reflection
open Microsoft.Office.Interop.Excel


let app = ApplicationClass(Visible = true)

let sheet = app.Workbooks
               .Add()
               .Worksheets.[1] :?> _Worksheet
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜