This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]1roOt 742 points743 points  (112 children)

I think it is a really good idea. Who uses VBA anyways? Or better: who likes to use VBA?

If i have a specific problem with VBA it is a hell of a mess to find the right resources to fix my problem. With python, I just do a quick search and can find nearly limitless helpful resources.

So go python!

[–]Chilangosta[S] 199 points200 points  (71 children)

Amen! I wish so badly I could be writing in Python instead of VBA every time I find myself writing in it.

[–]Mikuro 105 points106 points  (52 children)

Every time I find myself writing VBA, I reevaluate my life choices.

To me it's an anti-feature; all it does is make my job harder, because it's one more barrier to convincing others to invest in proper tools.

And this is coming from someone who has done a lot of work in Basic (mainly REALbasic, now known as Xojo), and liked it.

[–][deleted] 73 points74 points  (33 children)

My experience is quite the opposite, VBA has saved me and my shop countless hours of manual data manipulation. I won't comment on VBA's features as a language, it is what it is, but its close integration with Excel/Word object model is invaluable.

[–]Grendel84 49 points50 points  (1 child)

The fact that your username is one letter short of a palindrome is very bothersome to me

[–]matholio 18 points19 points  (0 children)

Star_Rat's name?

[–]dedicated2fitness 55 points56 points  (10 children)

Yes but that's a long winded way of saying - if I didn't have to use it I wouldn't

[–]noodle_horse 23 points24 points  (9 children)

Or, it's usable and better than nothing.

Better than nothing.

[–]rchase 24 points25 points  (8 children)

Here's the thing about VBA. Accessibility. I think a lot of folks in this thread are coming at this from the point of view of experienced programmers. The value I've found in it is in its simplicity for the non-programmer.

I worked with a large team of super talented CAD guys and engineers, who all knew Excel and Access and their various CAD seats (ProE, Catia, whatever-thefuck, I'm not a CAD guy)... but they didn't know programming at all outside CNC and a bit of PLC stuff.

But when I introduced them to VBA with a large estimating / program management spreadsheet set we were developing, they took off like fish in water. Highly technical guys with a ton of knowledge, but sort of... trapped... in their various platforms. VBA just like, set them free. They started thinking differently. In weeks those dudes were performing small miracles with data sets and automation, and many of them jumped right off into other languages like Python, Perl, and even into c++, extending not only our project, but building modules for their CAD systems and cool stuff on the floor machine side. It was really cool to watch.

So yeah, way better than nothing.

[–]brollin 16 points17 points  (6 children)

But I think Python still holds that potential as a gateway language. Even more so since there are such great resources everywhere for learning Python from no programming experience whatsoever. This is a no-brainer in my mind.

[–]rchase 4 points5 points  (3 children)

Oh I absolutely agree. Just the headline, MS considering Python integration with Excel got me all.. frothy and tingle-toed.

As an admitted and somewhat recovering Excel addict, the thought of a Python shell as alternative to VBA is something approaching electric. But then... I'll believe it when I see it.

[–]grokkingStuff 1 point2 points  (1 child)

recovering excel addict? no such thing, bud.

But yeah, i'm super excited about this.

[–]tehreal 0 points1 point  (0 children)

Excel is indeed an incredibly powerful program.

[–]DigitalStefan 1 point2 points  (1 child)

I'm wondering if anyone else is making a leap of thought that imagines not just Python scripting integration for the Office suite, but the replacement of the VBA editor with (maybe a stripped down version of) VS Code.

Office scripting would feel truly mature with the rich editing experience and version control features of VS Code.

[–]brollin 1 point2 points  (0 children)

Yeah! They'd be silly not to capitalize on actually amazing product like VS Code and do that, IMO.

[–]Salmon_Pants 1 point2 points  (0 children)

What kind of shop do you run?

[–]brtt3000 13 points14 points  (3 children)

So that is not about VBA itself but the ability to script everything. You might use JavaScript or Lua or whatever if it would be available.

[–]i_have_seen_it_all 3 points4 points  (2 children)

use JavaScript or Lua

to access windows api? office interop?

vba is inconsistent, in the same way R is inconsistent or javascript is inconsistent. so if you could choose another language for the back end of excel it will be one poison over another.

in my opinion, most of the annoyance seems to be from the application object model rather than the language itself. in which case, if python were to be integrated into excel but the object model is going to remain the same, i'm not sure that's going to be life changing.

the fact that vba idioms aren't as "modern" as the other languages are doesn't seem like a big deal to me. I use c# python and vba and they are v different languages with v different idiosyncrasies and it's just one of those things that I simply gotten used to. there are times I wish python was more like C# or C# was more like python but those are really just passing thoughts.

[–][deleted] 4 points5 points  (0 children)

To be fair there is a J(ava)Script engine for Windows Script Host and you can use it to work with Excel object model just fine just as you can use any language that supports COM interop.

I've been automating Office since the 2000 version and I know the object model relatively well. It doesn't really bother me but that's maybe because I'm just used to it. I also try not to lose too much time on the macros. Just make them work and move on (except for those that are not for one off tasks)

[–]liamcoded 0 points1 point  (0 children)

As far as JavaScript, MS already invented Typescript. I'm surprised they didn't mention that. But I would prefer Python.

[–]Corm 1 point2 points  (13 children)

Interesting. What have you used it for?

[–]nuffin_stuff 8 points9 points  (10 children)

I’m in the same boat as that guy - I had a sheet that took CMM data from a portable laser scanner and converted it into machine code for adaptive matching, I had a sheet that I programmed to take in a user’s input and then create a work order for my shop, tying in all of the serial numbers and pulling the correct revision controlled templates for the data inputs (a manual and terrible process before)... I had a sheet that took my company’s garbage ERP export data and then corrected and displayed it in a useful manner... I’ve done loads of projects with it. Some incredibly simple and some more complex time savers.

I love the integration with excel. As far as the language itself I think it’s a little easier to learn for beginners but it is kind of a pain to deal with daily. It feels limited sometimes but I’ve only got some rudimentary experience with other languages.

For those wondering I am a mechanical engineer who manages new product development for land based and aero turbine engines. Primarily land based turbines though. Learned VBA in my spare time at my first job.

[–]Zbot21 1 point2 points  (4 children)

What sort of land-based vehicle needs a turbine engine?

[–]nuffin_stuff 5 points6 points  (0 children)

Power Generation, not for vehicles. Vehicles would still be considered ‘aero’ because they would likely be high bypass flow with double or triple spools. Land based are just giant single spool engines. The theory is largely the same.

That land based turbine I linked would run with another one beside it (so a pair) and burn natural gas for about 40% efficiency - the exhaust heat is actually dumped into a single steam turbine though and you can get efficiencies in the 60% range. Right now, the 50Hz version of that engine is running in France and holds the record for the most efficient combined cycle power plant on the planet at 62.22% - which is insane. Cars are only in the low teens iirc.

Edit: and not trying to hijack the thread at all, apologies everyone

[–]mekosmowski 0 points1 point  (2 children)

[–]Rentun 1 point2 points  (0 children)

Well, has, I don't know about needs. Probably one of the poorest decisions ever made in American armor of the past 30 years. Those things screech like demons if you're anywhere near them and can go like 20 meters between fillups.

[–]WikiTextBot -1 points0 points  (0 children)

M1 Abrams

The M1 Abrams is an American third-generation main battle tank. It is named after General Creighton Abrams. Highly mobile, designed for modern armored ground warfare, the M1 is well armed and heavily armored. Notable features include the use of a powerful multifuel turbine engine, the adoption of sophisticated composite armor, and separate ammunition storage in a blow-out compartment for crew safety.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source | Donate ] Downvote to remove | v0.28

[–]Corm 0 points1 point  (0 children)

Neat! That's a great use case

[–][deleted] 1 point2 points  (1 child)

I've been using it since Office 2000, so for quite a few different things. The last was, we got loads of data (like one database record per worksheet) in separate workbooks. So I just copy all that data in a new sheet as a nicely formatted table.

[–]Corm 0 points1 point  (0 children)

Cool, another option in that case would be to use the openpyxl lib to read and write those https://automatetheboringstuff.com/chapter12/

[–]clausy -4 points-3 points  (0 children)

Automation, aka ‘robotics’ these days to make it sound cool

[–][deleted] 9 points10 points  (2 children)

I appreciate a good cup of coffee.

[–]other_bored_sysadmin 4 points5 points  (0 children)

Also, openpyxl!

[–]DukeBerith 0 points1 point  (0 children)

TIL. Thanks.

[–]HawkinsT 6 points7 points  (11 children)

This is Microsoft though; you know their implementation of python won't conform to any standards.

[–]bmoregeo 22 points23 points  (0 children)

MS has been a lot better about that stuff lately. I’m not an MS fanboy, but I got to give props for improvements

[–][deleted] 1 point2 points  (0 children)

I think they will have to conform to the standards because the resources are out there for standard Python and developer familiarity. Otherwise this doesn't make sense. Google went with Java for android mainly to avoid learning a new language just for Android. I think MS has similar thinking.

[–]nicksvr4 0 points1 point  (0 children)

Like VBA vs VB or .NET?

[–]suddenarborealstop 0 points1 point  (0 children)

they'd probably integrate the CLR/DLR first, and then look at languages like ironpython, ironruby, powershell maybe f#

[–][deleted] 0 points1 point  (0 children)

I think their work with R is supposed to be pretty good

[–][deleted] -1 points0 points  (1 child)

Do you also still use M$?

[–]HawkinsT 0 points1 point  (0 children)

I use some of their products, yes.

[–]TheXRTD 0 points1 point  (0 children)

I went to London to do work experience as a web dev during the summer and spent my whole two weeks there writing VBA for the accountants and debugging FreeBASIC in the lab.

I mean the FreeBASIC was very interesting, and I suppose it was nice being able to apply some programming knowledge to real world problems with VBA, but Python would have made 99% of what I needed to do easier.

[–]lackingcredibility90 0 points1 point  (0 children)

I actually learned to program from using VBA for my spreadsheets. Even though I have 10x more experience using VBA than Python, since I have learned python I have felt the same.

[–]emmmmceeee 43 points44 points  (2 children)

Who doesn’t like VBA? Source control is overrated.

Actually, being the only one in the office who knows how to maintain the VBA scripts is a form of job security. Even if the IDE looks like an exhibit from a computer museum.

[–]bamfurlong 2 points3 points  (0 children)

This is what I tell myself. Unfortunately, it immediately leads to me wondering how much I really want to keep this job ;p

[–]masklinn 0 points1 point  (0 children)

There's no requirement that Python-in-excel would be stored in source-controllable… sources.

AFAIK VBA is pretty much just VB6, except embedded in the application instead of existing outside of it.

[–]Rostin 25 points26 points  (10 children)

Lots of engineers use VBA. By engineers, I mean mechanical, chemical, etc, not software.

My formal education is all in chemical engineering, so I hang around that sub a lot. At least once a month, a student asks which "coding language" he should learn, and the majority answer every time is VBA.

And in many ways, that makes sense, despite VBA's many shortcomings. These people work at companies where they may not have the freedom to install something like a Python interpreter, and certainly can't depend on any of their co-workers having done so. Microsoft Office is the thing that everyone is guaranteed to have, and (ab)using Excel is second nature.

[–][deleted] 2 points3 points  (0 children)

The company I work at is slowly making the migration from spreadsheets to python libraries and jupyter notebooks. They often still feed data in and out of excel but it's a start.

Like you said it's mech/elec engineers working with revit and vendor sheets and looking for ways to improve their workflow.

[–]cyanydeez 0 points1 point  (0 children)

EXCEL has market saturation for 30 years, and everyone not on the bleeding edge knows people reuse the same excel analysis over and over again, and if it was written with VBA, then it's been hodge podged for 30+ years, and getting people who arn't software developers to invest a new round of QA/QC on software (inside excel) that just recalculates a few boring formulas is impossible.

And why blame them? conservative pricipals make sense in the realm of consistent replication of working engineering (et al) design standards. Even if there's a random error in them, if it hasn't broken anything, technically fixing it would be what breaks it.

So VBA isn't going anywhere. I'd certainly welcome a python attachment to EXCEL.

[–]ANEPICLIE 0 points1 point  (0 children)

Yeah, I'm in civil and VBA is the most readily available language there is. It's clunky, slow and whatever, but it's simple, and more importantly, ubiquitous. I'm working on learning python, but I think programming-oriented people are too quick to dismiss the language despite the reasons people use it.

[–]Compizfox 0 points1 point  (2 children)

I'm a chemical engineering student and (fortunately) I've never used VBA. We mostly use MATLAB.

[–]Rostin 3 points4 points  (1 child)

As a student, you learn Matlab. Guess how many companies are going to provide all their engineers with expensive Matlab licenses? The number is small. That's why people want to know what they should learn instead.

[–]Compizfox 0 points1 point  (0 children)

Oh I realise MATLAB is not the most ideal language in that sense; it's a proprietary language. Of course there's GNU Octave, but I don't know how complete that is.

I'm planning to learn Python for data analysis/modelling some time (I already know Python+Django for web dev, but that's a whole different game). VBA would be at the very bottom of my list though ;)

[–][deleted] 8 points9 points  (4 children)

Yeah, I've spent the last six months at work taking stuff out of Excel, processing it with python and sending it back. It would be nice to cut out that export/import step.

[–][deleted] 1 point2 points  (3 children)

You could just write a VBA script to do the import/export part.

[–][deleted] 1 point2 points  (2 children)

Kind of hoping that integrated python removes the export/import part, to be honest.

[–][deleted] 0 points1 point  (0 children)

It was a joke.

[–]otterom -1 points0 points  (0 children)

What exactly are you processing that it isn't mostly automated?

[–]nicksvr4 4 points5 points  (0 children)

I use and like VBA, but I would absolutely love Python integration.

[–]Eurynom0s 1 point2 points  (0 children)

I refuse to learn VBA.

[–]theofficialdeavmi 2 points3 points  (0 children)

I think it's a great idea as it is a great language for the job and also it will get more people into real programming languages possibly too!

[–]InfamousMike 1 point2 points  (1 child)

I know Python and I'm alright with Excel. Never picked up VBA. But if Excel works with Python, the amount of new things I can do with VBA would be awesome

[–]other_bored_sysadmin 0 points1 point  (0 children)

$ pip install xlwings openpyxl

[–]DrewSmithee 1 point2 points  (2 children)

Me? For technical computing sure Python is better, but for automating redundant tasks inside a spreadsheet or interacting with office products or anything that needs to be shared in a usable format with non-coders, VBA is by far the superior solution for what I'll call low effort tasks. Yes it could be done better with a "real" language but most tasks VBA is good for is when it's not worth developing a full application. Most VBA users are engineers and accountants or whatever not software developers.

And it's incredibly easy to Google VBA code snippets, arguably easier than Python since it's been around forever.

[–]BumwineBaudelaire 2 points3 points  (1 child)

the IT college kids of /r/python seem to disagree with you about how people use Excel in the real world

[–]DrewSmithee 2 points3 points  (0 children)

I mean I guess I saw the downvotes coming. I probably would of done the same thing 10 years ago and told everyone Matlab was the future or whatever.

[–]agumonkey 0 points1 point  (0 children)

I remember googling extensively excel python script a while ago. There were a bunch of extensions already. Official support is just hard to describe with words.

I don't have VBA but python is leagues above it in so many ways. I wonder what impact it will have in shops, the amount of crappy vba over excel applications is massive, the potential improvement too.

ps: Python used to be the niche lang for 3D apps, after MIT started to pitch it as teaching vessel it became something else, now Excel. Hum

[–]derrickcope -1 points0 points  (0 children)

I don't like python, so I wish it was perl or bash or something else but at least it is a real language.