I have a series of big excel files that work like a program, but I hate beeing tied up (stuck in VBA for excel 2003), so...
Whats the best way to implement a gui over a excel vba program (office 2003)? (are there any tools for that... I want to move away from the office suite, but still have it in the background)
Or what's the easiest alternative for migrating this code to a more open language.
Any ideias?
Have you looked at VSTO?
Resolver One is a Python spreadsheet system with strong support for importing from MS Excel. It's often used for the situation you describe.
Related
Background and Problem
I lead a team of tech writers. Our team has a Word template (.dotm file) that has a bunch of VBA macros we've created over the years to help us automate tasks in Word. The macros are obviously stored inside of a .dotm template. Given that the code is stored in a binary file, the code is not easily traceable across commits.
Currently, we have to pull the changes on the branch and then open the macro inside Word's embedded code editor from the .dotm. But there's no way to see what exact code changes someone else made line by line or resolve conflicts using something like Beyond Compare.
What I Need
I'd like to find a way to automatically expose the VBA code from the .dotm as some kind of text file so that we can:
Do Word VBA coding tasks within VSC
Easily track and review each others code changes at the line level using our git repository
Resolve merge conflicts more easily
Has anyone found a way to do this?
What I've tried
I've tried searching online and on stackoverflow.
Hoping it might help, I installed ScriptLab, and I after following the MS tutorial, I now have Office Add-Ons working with VSC.
(https://code.visualstudio.com/docs/other/office),
(https://learn.microsoft.com/en-us/office/dev/add-ins/tutorials/word-tutorial) While the Office Add-Ons through VSC does provide an alternate (more modern) way of automating using Javascript, and the .js files are commit-able, it's not providing a way to expose the Word VBA, at least not that I could see.
Thank you in advance!
ScriptLab add-on is for playing with JavaScript code instantly, not designed as a macro infrastructure in Office.
Sounds like you need to switch your VBA macros to COM add-ins rails. There is no converters that can do this part of work for you automatically.
You may consider creating a VB.NET based add-in. In that case you will avoid language translating issues. You may find the Converting Code from VBA to Visual Basic .NET article helpful. It presents issues to consider when converting your Microsoft Office solutions from Visual Basic for Applications (VBA) to Visual Basic .NET. Provides a general overview of their differences, and then uses examples from Word and Excel to describe how you can use Visual Studio Tools for the Microsoft Office System to convert your code.
I downloaded the Mini Calendar and Date Picker add-in from the Microsoft store and I would like to change a little bit of its functionality in VBA but cant seem to locate the add-in file anywhere . I activated the add-in and it works but it doesn't appear in the Active Application add-ins window under options so I don't know how to locate it. How can I go about this?
This is mentioned in the comments, but I'll officially answer as it's a common misconception that all Excel ADD-INS are written in VBA with an xlam file (particularly amongst financial Excel people who have just learned to write in VBA).
No. You cannot edit the code. It is not written in VBA and there is no xlam file, only a DLL file, which is much harder to interpret.
More "serious" add-ins, such as those found in Windows store, or are released by major software providers (SAP, Oracle, Microsoft) write their add-ins with C+, JavaScript or VB.Net. There's colossally more coding libraries in these languages than VBA, and the output of a DLL file makes it much harder for people to "steal" their code (as the OP intended to do, even if in a harmless nature).
So VBA enthusiasts won't be able to (easily) edit the code or learn from it.
I'm making a program that will eventually be used as a simple program to keep track of customers at a campground. I had originally made an excel spreadsheet for the owner where they could add how much each renter paid per month and I set it up in a way that it totaled each month and the whole year for him and displayed it like an accounting spreadsheet, with double underlines and the like. Now, he no longer has a copy of excel. I have set him up temporarily on google docs, but besides it not having all the functionality of excel, he doesn't trust it on the internet and has a hard time navigating to it.
What I'd like to do is create a program that would use forms to let him easily enter information, but display it either in the excel spreadsheet like he's used to seeing, or something that looks and prints pretty much the same.
I've seen people use SQL to work with access and excel. I'd like the connection string for that if anyone knows it. I have Visual Studio 2013 and I have Excel 2010 at home and work and 2013 at work.
My big question for you guys, that I can't find any information on is whether or not excel will work if I install the program on his computer that doesn't have excel installed? Does it work because it's part of the program? Can I only use the sheets and formulas that I set up when I created it? Can I generate new sheets using the program once it's installed on a pc that doesn't have excel installed on it? Thanks a lot for the help guys. I can't find information on this anywhere.
It depends what library you use. If you use Microsoft.Office.Interop.Excel than you will need to have the specific version of excel installed or at least a version that supports your interop assembly (my past experience was that it had to be exact).
The other option is to use another standalone third party library that reads the zipped XML files (.xlsx) and can manipulate it through that. Some libraries worth mention:
NPOI
EPPlus
ExcelLibrary
Is it possible to write VB.NET code to be used in an Excel spreadsheet without using Visual Studio? In other words, is there a built-in VB.NET editor for Excel that can be easily accessed like the built-in VBA editor? Or can I coerce the built-in VBA editor to allow me to write VB.NET code?
If the answer is no, do you know why Microsoft has not implemented this in Excel? It seems the ease of accessing the VBA editor is one of the reasons people still write new VBA code today. If Microsoft wants to be rid of VBA then why not make VB.NET more accessible in Excel? I'm not interested in speculation but instead any official word from Microsoft.
Some direct answers to the direct questions:
is there a built-in VB.NET editor for Excel that can be easily accessed like the built-in VBA editor?
Answer: No
Or can I coerce the built-in VBA editor to allow me to write VB.NET code?
Answer: No
If the answer is no, do you know why Microsoft has not implemented this in Excel?
Answer: since I'm not a Microsoft insider, No (but I could speculate...)
There are, of course, a variety of non-built in ways to interact with Excel. But I'm sure you already know that.
That's kind of a silly question. The internal language for MS Excel currently happens to be VBA. And frankly. VBA is pretty darn close to both VB6 as well as VB.Net, IMHO. Certainly the two are more similar than, say C++, Java, Perl or any of a million other languages.
So why isn't doesn't Excel use VB.Net (or, for that matter, C#)? Because Excel doesn't come with its own .Net runtime, and doesn't require you to have a .Net runtime to use it.
So why can't use use VB.Net (or C#) with Excep? If course you can use them with Excel. You can write a VB.Net program that reads and writes Excel spreadsheets, that invokes Excel functionality, that uses Excel as a datasource, etc etc etc.
So what more could you ask for ;)?
I am now engaging in an excel vba project. It's a excel front interface for the workers in a site with an Access database in the company network. I dont like much the VBE in Excel 2007, so im wandering if I can do this with VB.NET, which seems to be a more adorable IDE. And where can I find some resources on this? Or recommanded books? Thanks!
Im using Excel 2007 et VB.NET 2008
You could also try Excel-DNA (free). There are many other products out there too. You can make it work with VB.Net Express also, you just need to add a reference to your excel SDK. Also, Add-in Express looks pretty nice. I've never tried it though (costs money).
I think you are looking for Visual Studio Tools for Office: VSTO.
This allows you to develop using VB.NET (or indeed C#) but with full access to the Office automation facilities.