开发者

F#, another VBA in Office? [closed]

开发者 https://www.devze.com 2022-12-13 07:41 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reope开发者_运维百科ned, visit the help center. Closed 13 years ago.

Excel is a great spreadsheet software, a even greater front UI for Business Intelligence in many companies. Often VBA is used to write the extensions, or to call other DLLs.

As Excel itself is functional, F# will company Excel very well to write data analysis procedures.

I am thinking whether F# or a variant of F# will become next VBA in office. Any news or rumors?

EDIT: I don't mean to replace VBA in office. I mean F# could be an alternative in Office to write scripts.


MS is offering VSTO, a bridge between every .NET language and MS Office. I do not think they will be favouring F# over any other .NET language for this task.


I don't think F# is a likely candidate to be the "next" VBA. Let's look at two major ways VBA is used in Excel:

1) Writing user-defined functions

2) Automating spreadsheet manipulation

I think (2) is much more common than (1). That's mostly imperative work using the Excel object model, and doesn't play to the functional strengths of F#. That's not to say F# or other languages wouldn't be just fine for scritping imperative spreadsheet operations, but VBA is also fine for that, and (just like its BASIC ancestor) is targeted at less experienced programmers. VBA was (and is) very important to the success of Excel, precisely because it made "end-user programming" relatively easy for people who were more end-users than they were programmers.

As others have pointed out, (1) can readily be done in F# right now, albeit in the form of a library, not tightly integrated with Excel. I myself would kill for a real functional language that was more tightly integrated with the sheet itself. However, I don't think it should look like F# per se. The real win would be the ability to express functions in a very Excel-formula-like syntax, and use them as first-class values in the spreadsheet. Lately a colleague and I have been building some models that are quite complex, but must be built and delivered in Excel. We've experimented along those lines, and it seems to be useful to us, but our implementation is definitely pretty clunky.


If you meant using F# for Office interop, you might want to try the dynamic lookup operator "?", but I think I'd prefer C#'s dynamic.

If you meant writing math functions for Excel, then yes, F# is a good tool for that. In fact here's a rewrite of Excel's financial functions in F#. You could write your own functions in F# and then use VBA to call them from Excel.

0

精彩评论

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