Building a user interface to an Excel model - excel

I built an excel model used to analyze real estate transactions. I would like to create a user interface to overlay the model so that the file can be distributed to clients to evaluate potential investments
The interface will serve two primary functions:
1)Enhance the user experience by creating an easy to follow input page. The entered data will then flow through to the model from which reports will be generated for the user to view.
2)Protect the intellectual property of the model by restricting the user from the underlying model. The user will not be able to view or edit the formulas in the excel file.
I believe this can be done using MS Acess/Visual Basics but I was hoping to find a program that is more professional looking. Can anyone suggest a program/programming language in which this type of user interface could be created?
Thank you in advance for your help.

You don't have to use Access, VBA (Visual Basic For Applications) is built right into Excel. There are good books available and lots of web resources. Your main problem seems to be the UI is not professional - I'd disagree, out of the box it will look like an application developed 5-10 years ago, but it will still work and look ok.
If you want a really slick interface, I'd suggest you look at WPF and integrating that into Excel. However there is a big learning curve to get that going, I'd get a basic UI going, show/sell that to your customers, and then ask them what they want.

I think my first question would be how savvy are you with development? You really didn't elude to that in your post.
If your using Excel 2007, there are ways to hide menu commands in Excel and remove a lot of the current interface and replace it with your own. It looks like Excel and functions like Excel, however, the ribbon interface looks vastly different. The other side is just to add a Tab or Menu and have your commands there. It sounds like you want use Excel as your UI, but replace the commands with your functions.
If you want to HIDE your IP, and you decide VBA is the way to go, then your code is stored inside the Excel Spreadsheet and is accessible to anyone who knows how to open the VBA editor.
If you decide to do it in .NET, then your functionality exists in an assembly outside Excel, and the .NET runtime loads it when you open the Spreadsheet. No amount of poking around inside Excel will help them find your "code".
There are lots of code samples to help you with both. I would recommend VB.NET if you decide to do .NET. From a pure syntax point, VB.NET handles lots of the office programming "quirks" well and can help you speed development. Here is the office development site, that you can go and get information before making a decision.
Also, according to this article you need to buy Visual Studio Professional 2008 or 2005 to get the graphical designers and such. If this isn't feasible or affordable, VBA might not be a bad idea to start with.

In regards to my development savvy, I am novice. I am familiar with the basics of VB but doing the actual development for the type of UI I have in mind is beyond ability. I plan to hire a developer to create the UI but before I can do that I need to decide the language it will be built in.
MrTelly, Chris, I appreciate your advice.
I am currently in the search for a skilled developer willing to collaborate to determine the best language to build the UI and then execute the development. If you have any recommendations or would like to discuss the project yourself I can be contacted at phtwright#gmail.com .

Related

Generating a tree in Excel

I have some data in an Excel sheet that represents a hierarchy. As the tree is large and reviewing the data is becoming quite a task, I am trying to generate a pictorial representation of the tree. Excel doesn't seem to have built-in support for tree generation. What would be the best way to generate the tree from within Excel? Are there add-ons available?
Suggestions related to tree generation using other tools would also be welcome. (I have already tried the org chart option in Visio. For some reason, it could not open my Excel file.)
There is a solution for both node-link tree or treemap. But it do require another tool since drawing this on Excel only would be very difficult if not impossible.
I propose to use the Funfun Excel Add-in which allows you to use JavaScript directly in Excel. With the capability of using JavaScript, you could make use the powerful libraries like D3.js or HighChart.js so that drawing tree chart would be much easier.
Here are two examples of generating trees in Excel.
I used D3.js in the first example and Hightchats.js in the second example. I made those two examples in Funfun online editor and then linked them to my Excel. You could check the code on the links below.
https://www.funfun.io/1/edit/5a36aaf145ac15144af3fe1e
https://www.funfun.io/1/edit/5925013604ce702ccfb22b0b
Here is what you need to do to link these samples to your Excel.
1). Insert the Funfun add-in from Office Add-ins store
2). Create a new Funfun or load a sample from Funfun online editor.
3) Have fun :)
Disclosure: I'm a developer of Funfun
Maybe you could use Excel Treeview control in a useform, you can find a great tutorial here. i have never used it personaly though.
Seems like VisualStudio 2010 allow you to do things a little smarter : you can have a look here. But i don't know enough this part of MS to help you anymore on this way.
And yet, the subject was discussed on another forum pointing to other third party tools.
I have used the ActiveX Treeview Control on Excel sheets, and it is fine. HOWEVER, depending on your version of Windows and which Security Updates you have, it may or may not work. I developed an application using one, for a major City bank, but we had to re-work entirely when certain upgrades were applied company-wide. After a very long and useless discussion with Microsoft in the US, we got nowhere at all. If you Google "excel treeview security upgrades" you'll find various discussions. I suggest using 3rd party, though I can't suggest one.

What would you switch to using instead of excel in a corporate workplace, when you aren't a programmer by trade?

I have a friend that is working on a company without any real IT people, and they've gone the classical corporate route of stringing things together with Excel macros whenever they need something. I was trying to figure out what alternatives are available for someone that isn't a programmer by trade.
What is an easy alternative to Excel when you want to distribute data offline together with forms for manipulating it, that doesn't have a steep learning curve? I was going to suggest he learn Python and SQL-lite, but I'm hoping StackOverflow can come up with a wiser answer.
Honestly, for non developers (and if you do not have a dev staff in-house) there really isn't anything wrong with Excel.
That being said, Lightswitch is a new and fairly interesting option for basic forms over data work (although it's still a bit green).
IMO once you go down the route of languages like Python, etc. you're really looking at someone who is going to have to be a programmer (and they may be shooting themselves in the foot on a regular basis).
In that type of environment users end up with Excel or Access to manipulate data. Excel is convenient where cells in row are calculated the same way, but with exceptional cases. Access is better for calculating over multiple rows easily, data management forms (yes Excel can do it too, but Access is easier) and formatted reports.
The best situation I've arrived at in this type of environment is standing up read only "data warehouse" that Excel and Access users can link or download data from to manipulate on their own. For this situation SQL Server is probably the right choice and I use quotes around "data warehouse" because I don't mean it in the technical sense, but rather just a convenient repository. That way you have one definitive system of record. Then any report generated in either tool repeatedly becomes a candidate for incorporation into that warehouse.

I Need VBA Library References

I'm doing a gig where there is a need to write a few simple VBA macros for Word and Excel. This is a skill I haven't used in about 8 years -- and things have changed! Aside from the little detail that VBA is clearly in legacy mode, with minimal support, there's all the new security measures designed to close VBA as a malware vector.
Most of this can be worked around with a little effort. But here's a biggie: on some machines (not all for various reasons), the IT people have disabled VBA's ability to reference external libraries. If you give a user a VBA application that uses the MS scripting runtime (handy regular-expression API) or the automation library for another application (for controlling Word from Excel) they just don't work. If you open the VBA IDE on the user's machine, Tools/References is grayed out.
I could work with the IT people to re-enable library references, but there are also external users who might have this limitation. So I need a way to bypass it.
If I buy a certificate and sign the macros, will this give me back references? I can get them to spend the money, but I'm not going to do it unless I'm convinced it will solve the problem.
Can you use late binding?

How to use VBA to automate several Office applications?

Although I've done VBA projects within a single application for both MS Access 2007 and Excel 2007, I haven't automated multiple applications at the same time. The generalized project is to open access, run some update queries that appends data to various tables. Then Excel needs to get the data. Some formating changes are needed in Excel, such as grouping that doesn't automatically change the date range. Finally, I plan to build it out such that the excel file will be emailed automatically.
Some parts of this are clear how to accomplish it, such as Excel will be getting the data by ODBC from Access. But where should the master VBA live? I could have a button in Access that would start running Access VBA, but is it a good practice to have the Access VBA start manipulating Excel? Does that make it difficult to debug?
To get started from Access, add a reference to the Excel object library. Then use the object browser to familiarize yourself with how the Excel object hierarchy looks from within Access. It is going to be somewhat difference, because the top-level object in Excel code is implicit (as it is in Access), and has to be explicitly referenced when coding in Access.
The Access Developers Handbook has excellent chapters on automating the rest of Office from Access.
Last of all, it's best once you've coded using the reference to the other app's automation library to help you program, you want to switch to late binding so you can remove the reference. This means not using any of the external library's specific data types (you mostly use plain object variables) and using none of the constants defined in the external library. My production code with late binding usually includes the early binding version commented out, alongside the late binding version.
I think the keywords you are looking for is "microsoft office automation".
Make an application in you favorite programming language that supports COM interfacing and then use automation to do the manipulations in the different office applications.
Look here c# How to access an excel cell? and here How to read data of an excel file using c# ? and Google.
I have recently done something quite similar to this, and have found that I can output HTML with built-in CSS for formatting that loads quite nicely into Excel. I used Access to allow users to build their required output, only opening Excel to display the results. You may find that HTML output makes for nicer emails.
Do all the work in Access VBA. See the following URLs for some sample code
Modules: Sample Excel Automation
Modules: Transferring Records to Excel with Automation
Also note that if you are dealing with multiple versions of Excel late binding becomes a necessity. Late binding means you can safely remove the reference and only have an error when the app executes lines of code in question. Rather than erroring out while starting up the app and not allowing the users in the app at all. Or when hitting a mid, left or trim function call.
This also is very useful when you don't know version of the external application will reside on the target system. Or if your organization is in the middle of moving from one version to another.
For more information including additional text and some detailed links see the Late Binding in Microsoft Access page.
As far as emailing goes there are a number of options at the Microsoft Access Email FAQ
You may put the code in Access, or Excel. In my experience, that is easier to work with than splitting the code between the two (which also works).
If you find that the automation code runs too slowly, you can split the code, so that Access is run by functions in Access, and Excel from functions in Excel, and the master code just runs routines in both. In this case, you can put the master code where-ever you get the nicest user interface for starting things. I've used C,Access,Word and Excel, and where you put the start button doesn't matter a whole lot if all the code is somewhere else.
If your users or maintainers are more familiar with one application, you may wish to put your main or master code there, but more often I find it is better to put the main or master code with the guts of the application, so that I can have no code at all in the other partner.
From the brief description, it sounds like more work will be done in Excel, so I would put all the code there.
Pulling the data out of Access doesn't even need an Access Application object - a DAO or ADO or ODBC object will work (or even DDE), which will be much faster, much more robust, much easier, much better than having both applications open and automating one from the other.
If you start from Access, it sounds like this project will require an Excel automation object. That works well now, but it is still much slower and more fragile doing it with just Excel and a DAO object.
I haven't done VBA for ages although Access was my entry-point into the world of programming. Moving from Access 97 to Visual Basic was easy and I remember that I wrote a lot of stuff using Access more like a VB-form for doing many kinds of tasks (not necessarily database-stuff).
This is the reason why I think you should stick to Access and from there, with help of VBA, do your stuff in Excel etc..
Good luck

What is a good web-based Grid that accepts Excel clipboard data?

Any good recommendations for a platform agnostic (i.e. Javascript) grid control/plugin that will accept pasted Excel data and can emit Excel-compliant clipboard data during a Copy?
I believe Excel data is formatted as CSV during "normal" clipboard operations.
dhtmlxGrid looks promising, but the online demo's don't actually copy contents to my clipboard!
I'm currently using dhtmlxGrid and we have the Excel copy/paste functionality working. dhtmlXGrid is the most full featured javascript grid package that I've found.
On their website, dhtmlXGrid claims to support Clipboard functionality in the Professional version. (However, I noticed the Sample on their site isn't working on my Firefox. EDIT: It's probably the permissions issue that Nathan mentioned.)
In any case, we had to do some extra work to get the exact Excel copy and paste functionality we wanted. We essentially had to override some of their functionality to get the desired behavior. Their support was pretty good in helping us come up with a solution.
So to answer your question, you should be able to get them to support copy and paste if you purchase the Professional version. I'm just warning you that it may take some additional work to fine tune that behavior.
Overall, I'm happy with dhtmlXGrid. We use a lot of their features. Their support is pretty good. They usually take one day to respond since they are in Europe (I think). And Javascript is by its very nature open source so I can always dive in when I need to.
Not an answer, but a warning: my company bought the 2007 Infragistics ASP.NET controls just for the Grid, and we regret that choice.
The quality of API is horrible (in our opinion at least), making it very hard to program against the grid (for example, inconsistent naming conventions, but this is just an inconvenience, we have complaints about the object model as well).
So I can't say that I know of a better option, I just know I will give a try to something else before paying for Infragistics products again (and the email support we got was horrible as well).
I was wrestling with this problem several years ago (2004 I think). We ran into the problem that Firefox doesn't allow scripts to read the clipboard by default (but you can grant access to the clipboard).
There's other ways of reading the clipboard data as well...Flash, for instance, can read the clipboard. There's a good article on ajaxian to explain how do to this behind the scenes.
In the end, we couldn't find a web-based Grid that fit the bill, so we had to create our own in a mixture of Actionscript and Javascript.
I'd hate to be Captain Obvious here...but what about a plain old .NET Gridview control? You can copy Excel data into it and out of it...and you can run it on any system with the .NET platform installed.
http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:clipboard_operations

Resources