HackerTrans
TopNewTrendsCommentsPastAskShowJobs

sancarn

no profile record

Submissions

Ask HN: What are your thoughts on no-code tools like Microsoft's Power Automate?

3 points·by sancarn·2 tahun yang lalu·3 comments

Why do people still use VBA?

sancarn.github.io
324 points·by sancarn·3 tahun yang lalu·408 comments

comments

sancarn
·2 tahun yang lalu·discuss
COM is still actively being used. Not sure why you think it's a problem with windows too. COM is and always has been quite revolutionary imo.
sancarn
·2 tahun yang lalu·discuss
Not sure about other people but most of my apps I've made actually can't be made in Office Scripts... They are useless for my needs.
sancarn
·2 tahun yang lalu·discuss
> good software that exists on other platforms

You mean like AppleScript?
sancarn
·2 tahun yang lalu·discuss
> They had announced Python support for Excel a while back and I wish it was better promoted as a viable VBA replacement

But the existing implementation of Python means that it's not even close to a viable replacement lmao
sancarn
·2 tahun yang lalu·discuss
Untested but something like this in VBA should suffice:

    Dim rng as range: set rng = Sheet1.UsedRange
    Dim rows as Long: rows = rng.rows.count
    Dim cols as long: cols = rng.columns.count
    Const SIZE as long = 500
    For i = 2 to rows step SIZE
      Dim wb as workbook: set wb = workbooks.add()
      wb.sheets(1).range("A1").resize(1, cols).value = rng.resize(1).value
      wb.sheets(1).range("A2").resize(SIZE,cols).value = rng.offset(i-1).resize(SIZE).value
      Call wb.SaveAs("C:\Temp\" & i & ".xlsx")
    next
sancarn
·2 tahun yang lalu·discuss
These are the reasons I struggle to leave Windows too. Also the open API ecosystem is great. You can do pretty much everything with win32 libraries.
sancarn
·2 tahun yang lalu·discuss
> At least I have yet to see one that is actually useful in the sense of a generic (or even a single-purpose-built) language

Yeah as said, https://github.com/enso-org/enso seems to be a general purpose functional programming language with visual editor, but otherwise I haven't really seen any no-code solutions worth their salt. I'm not particularly a fan of enso either, but it's the best I've seen.
sancarn
·3 tahun yang lalu·discuss
Certainly! If you're ever interested in seeing some awesome VBA stuff I have a big list here: https://github.com/sancarn/awesome-vba

Lots of awesome stuff still in the VBA/VB6 community!
sancarn
·3 tahun yang lalu·discuss
In our case (and in the article), we wanted to collaborate with IT, code along-side them in a technology of their choosing. However IT explicitely told us that they would NOT allow us to do any coding whatsoever.

I, as an SME, am fully happy coding in C#, Java, Rust, whatever! As long as the language is turin complete, is pro-code and versatile enough, I'm all ready to go.

Do note that IT actively chose to develop the solution in Microsoft PowerApps, despite my advising that the solution would be better suited as a web app.
sancarn
·3 tahun yang lalu·discuss
Actually, every language in theory. At least any language which can use COM APIs can interact with PowerPoint. Ruby, Python, NodeJS, C, C++, C#, Java, Rust, ... Pretty much you name it and it can control powerpoint unless it is sandboxed.
sancarn
·3 tahun yang lalu·discuss
I do RPA from VBA personally using IAccessiblity. See stdAcc (https://github.com/sancarn/stdVBA/blob/master/src/stdAcc.cls) and an example (https://github.com/sancarn/stdVBA-examples/tree/main/Example...). You are basically doing the same as what you'd do in UiPath, by the looks of things. Just a slightly different flow.
sancarn
·3 tahun yang lalu·discuss
> they would have to essentially start from scratch if they wanted to do anything else like Python

I do tend to disagree here. It really depends how invested they are with VBA. Many VBA skills are highly transferrable to Python and other high level programming languages.

I was fortunate to have experience with multiple languages from the start, but many of my colleagues have programmed in other languages other than VBA after learning VBA only to begin with. From Ruby to Python and beyond.
sancarn
·3 tahun yang lalu·discuss
> so why are you complaining again?

Because a job that would take 15 minutes turns into a 3 hour task. It might surprise you but some people actually enjoy their job and ticking off tasks :)
sancarn
·3 tahun yang lalu·discuss
I have invested copious amounts of time into building VBA libraries (https://github.com/sancarn/stdVBA) and as much as I love vba there are some highly limiting actual problems with VBA (https://sancarn.github.io/vba-articles/issues-with-vba.html) which really hurt the language. But yes a large portion of the hate VBA gets is from the state of VBA projects (https://sancarn.github.io/vba-articles/why-is-vba-most-dread...)
sancarn
·3 tahun yang lalu·discuss
Good if all you do is display a fancy UI for some data entry or visualisation, but OfficeJS can't do half the things VBA can do unfortunately. If only the addin system had FFI. I'd switch forever.

Edit: Another big issue with OfficeJS is you need to be able to host a web server. That's not usually something most end users have access to...
sancarn
·3 tahun yang lalu·discuss
Agree, Python implementation in Excel is trash. Not at all a competitor for VBA. Not yet anyway.
sancarn
·3 tahun yang lalu·discuss
Microsoft recently released OfficeScripts, which are JS with a record macro button. Problem is, it's currently too limiting. Will be good in a few decades though if support isn't dropped.
sancarn
·3 tahun yang lalu·discuss
Honestly, this is something I've been wanting to do for a while... Last I looked though, I couldn't find many good resources on how WASI (or the byte code) worked... And VBA being single threaded might make things difficult too...

I have already built my own code interpreter in VBA to make Lambda syntax possible: https://github.com/sancarn/stdVBA/blob/master/src/stdLambda.... so I know it's definitely possible, just haven't figured out WASM yet...
sancarn
·3 tahun yang lalu·discuss
This is already happening with IT maintained systems though... As specified in the article. So it really isn't an argument imo.

IMO, companies should have a language of choice which is actively encouraged to be used by everyone for all automation needs. Different departments build libraries to automate aspects of their jobs and other departments can use them if needed. I.E. it becomes yet another tool, just like Excel.
sancarn
·3 tahun yang lalu·discuss
> We tried to work with them by giving them tools that plugged into Excel

This is probably one of the best ideas out there. If companies built a bunch of Excel Addins to leverage business systems, that would be revolutionary for many businesses.