6 ms·
Corps have a dev environment sitting right in Excel that doesn't need special (management, management's management, adding to a registrar of projects, budgeting
by throwaway154 3y ago
Corps have a dev environment sitting right in Excel that doesn't need special (management, management's management, adding to a registrar of projects, budgeting or project manager assigned, etc) approval for non-stock software. The stack's Excel, plus Sharepoint if you're really looking for a networked data store that also has a web interface.
From that end-user direction, solutions emerge. And they're in VBA.
- Dan_W 3y agoThat's exactly why I use it. Only dev environment available to me.
- 13of40 3y agoWindows ships with VBScript, JScript, CMD, C#, and PowerShell right out of the box. I recall interviewing a college guy around 2018, and he tried to educate me about how Windows doesn't have a good command line / scripting / automation solution beyond command.com. I think I still said "hire" because he had other talents, but damn.
- qotgalaxy 3y ago[dead]
- jodrellblank 3y agoPowerShell including ISE, with tabs, multi-line cursor, syntax highlighting, autocomplete, step-through debugger, snippets, scriptable/extensible.
- RajT88 3y agoPeople think I am nuts for preferring the ISE over VSCode, but the ISE never crashes while running scripts!
- hobs 3y agoThen you haven't used it enough :) The bare shell on the other hand is usually solid.
- RajT88 3y agoThat's for sure not true. For my bigger projects (over 200 lines), I tend to use VSCode. Just having a look at the larger projects I've got up on github, I'm over 2000 lines across 3 projects - all developed in Code. ISE does occasionally hang / crash, but it's quite rare compared to how VSCode behaves across every machine I've used it with. It really seems to be just a Powershell problem, haven't had the same issue in any other language. When I'm really making great progress on something, having to fart around with killing and restarting the shell constantly is really disruptive. Yes, Code has better and more features, but for me the extra productivity does not overcome the crashy shell.
- hobs 3y agoI think you might be misunderstanding what I didn't say - I use the console for debugging (Set-PsDebug!) and even then it crashes (sometimes.) I don't like vscode for powershell development and I find the pycharm experience for powershell (lol) much better.
- pjmlp 3y agoYou're not, I would also rather have the Powershell team improve ISE than their decision to migrate into VSCode, but alas.
- TheJoeMan 3y agoAnd yet if you send your PS script to say an HR person… it won’t run on their computer without messing with security settings.
- 13of40 3y agoNobody on the team wanted that, not even Snover, but we were making that thing in about 2005, when everyone was getting burned by email based zero days. Even though we had the Set-ExecutionPolicy thing there were boogeyman news articles immediately after the v1 release asking whether the new scripting language was...too powerful.
- resoluteteeth 3y agoPowerShell with ISE is a lot better than the VBA editor in many ways but you're still in the same situation of using a long deprecated ide with an ancient version of a programming language (ISE is deprecated and if you're using the built in version of PowerShell you're stuck on the last legacy framework version from 7 years ago forever and missing a ton of improvements and fixes from newer versions of powershell)
- jodrellblank 3y agoToday, yes, but ISE has shipped with Windows since what, XP? And VBA never has - it's a part of Office.
- Pxtl 3y agoSo disappointed that MS hasn't rolled out PowerShell 7 but I guess it's easier to develop a programming language when you don't have to deal with users.
- orthoxerox 3y agoWindows doesn't ship with C# out of the box. It ships with the runtime for .NET Framework 4.8, but not with the SDK.
- anthk 3y agoI think it does since the Windows XP days, at least a CLI based compiler/interpreter.
- orthoxerox 3y agoWould you look at that, it does! C:\Windows\Microsoft.NET\Framework64\ has both MSBuild.exe and csc.exe, but only for .NET Framework up to 4.0. I was under the impression that 4.8 was installed on Win 10 machines via Windows Update.
- TeMPOraL 3y agoAs I understand it, PowerShell allows you, out of the box, to write some C# code in a string, and then run it. And by C# code I mean regular classes with all the bells and whistles.
- justsomehnguy 3y ago*wink* $code = @' using System; using System.Drawing; using System.Runtime.InteropServices; using Microsoft.Win32; namespace Background { public class Setter { [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] private static extern int SystemParametersInfo(int uAction, int uParm, string lpvParam, int fuWinIni); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError =true)] private static extern int SetSysColors(int cElements, int[] lpaElements, int[] lpRgbValues); public const int UpdateIniFile = 0x01; public const int SendWinIniChange = 0x02; public const int SetDesktopBackground = 0x0014; public const int COLOR_DESKTOP = 1; public int[] first = {COLOR_DESKTOP}; public static void RemoveWallPaper() { SystemParametersInfo( SetDesktopBackground, 0, "", SendWinIniChange | UpdateIniFile ); RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true); key.SetValue(@"WallPaper", 0); key.Close(); } public static void SetBackground(byte r, byte g, byte b) { RemoveWallPaper(); System.Drawing.Color color= System.Drawing.Color.FromArgb(r,g,b); int[] elements = {COLOR_DESKTOP}; int[] colors = { System.Drawing.ColorTranslator.ToWin32(color) }; SetSysColors(elements.Length, elements, colors); RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Colors", true); key.SetValue(@"Background", string.Format("{0} {1} {2}", color.R, color.G, color.B)); key.Close(); } } } '@ $null = Add-Type -TypeDefinition $code -ReferencedAssemblies System.Drawing.dll -PassThru Function Set-OSDesktopColor { param ( $r,$g,$b ) $null = [Background.Setter]::SetBackground($r,$g,$b) }
- sancarn 3y agoVBScript is deprecated: https://nolongerset.com/vbscript-deprecation/ https://nolongerset.com/vbscript-deprecation/ JScript is deprecated, and is likely to be removed at some point too... CMD is often blocked on many people's machines due to group policy. PowerShell is really the only other option other than VBA, as discussed in the article. Only reason I haven't used PowerShell til now is the version was hidiously outdated and didn't even support classes... Of course with PowerShell you can evaluate C# code.
- vbezhenar 3y agoI don't understand how's Excel page with macros inside different from random exe file from security perspective? Does Excel have some kind of excellent sandbox implementation, so it's safe to run random macros on the work machine?
- dartos 3y agoCan you call os level functions from an excel macro? Can you access raw memory from it? If the answer to either of those is no, then that’s a big difference.
- meibo 3y agoYou can call any native or COM function from VBA, the only real limitation is that it's strictly single-threaded(-ish).
- nradov 3y agoYou can call Windows API functions from VBA.
- hnlmorg 3y agoYes you can. VBA can make the same Win32 API calls as VB6. Something I exploited back in the tail end of the 90s.
- anthk 3y agoCOM/OLE. Old as hell. Macro viruses in Office/Outlook has been a shitfest since late 90's.
- technion 3y agoThe "difference" is only an advantage to attackers, in that executables are typically blocked as email attachments and Office macros are not. Here's a ransomware incident report from someone opening an Excel document with macros enabled: https://thedfirreport.com/2023/05/22/icedid-macro-ends-in-nokoyawa-ransomware/ https://thedfirreport.com/2023/05/22/icedid-macro-ends-in-no...
- mr_mitm 3y ago
- donatj 3y agoThis. My friend automated his whole job in Excel. He supposedly can do a days work in fifteen minutes and then just hang out. Their computers are super locked down, can’t install anything, can’t go to any non-whitelisted sites, but they have Excel.
- meibo 3y agoThat was pretty much my first job, I strongly believe this still happens every day around the planet :) I wouldn't want to go back to that 30kloc of VBA though!
- asdfman123 3y agoThis sounds like a very specific, personalized version of hell
- wiseowise 3y agoI always read those “X automated their job, finishes it 15 minutes and then does whatever” and wonder how true are they? How could it be that nobody notices or cares?
- donatj 3y agoMy understanding is he basically gets paid to put data into easily automated categories, and the company is soulless and has no ambition for automating anything.
- prerok 3y agoI have a few colleagues that told me they have a job like that. Not done in 15 minutes but 2 hours, then they goof off for the next 6 hours. There are two reasons: 1. They have a specific job with a specific set of duties (think sysadmins, or administrative duties) in a large company or in a state beurocracy. 2. They would rather go home or do something more but they are not permitted: they have metered time in the office and other people would and do shut them down on any initiatives. To me, a workplace like that is like a kafkaesque nightmare but they seem to be fine with it, or rather, have accepted it. It lets them focus on other things in life outside of work.
- pyeri 3y agoPlus Visual Basic is a very powerful language on its own. Given an environment such as Excel Macros, its power can be unleashed and utilized to a great extent and that's what power users in many enterprises do. This is quite reminiscent of the good old "emacs operating system" paradigm just applied to a different context!
- toolslive 3y agoI've seen the following at least twice: some department manager (marketeers typically have a nack for this) needs something, can't or won't bother the development team and starts off with "how difficult can it be" and before you know it they've written a few hundred lines of VBA, which serves their needs. But then, the next phase starts: that scripts gets copied over (because Jim wanted to run it too) and modified (Jane has a different VBA version) and expanded (now it does "THIS!" too). Now it's a 1500 line kludge and they want to unload it, ie pass it over to development for maintenance.
- mathgladiator 3y agoAnd thats great because demand has be satisfied!
- lodovic 3y agoBut isn't that how it's supposed to work for these LOB type applications? Users prototype a solution and the developers then change it into a proper real world application. Alternative approaches are usually worse.
- liotier 3y agoLook at it another way: that script kludge is a prototype, a dangerous one of course, that embodies the functional requirement better than what the user could express. Understand its deep meaning (what the user meant to do and and not what they settled on considering their technical limitations) and you are ready to rewrite it into a proper implementation. We frequently stumbled upon this situations and we like them, because a well used kludge that reaches its breaking point has buy-in from all stakeholders for a well-budgeted industrialization !
- TeMPOraL 3y agoYes. And the entire thing is done in half the time it would take for the development team's managers to get through whatever bullshit agile scrum epoch meetings to ultimately deny the request because it's not worth their time - or worse, approve the request, and get you waiting a year for The Project Done Right.
- 3y ago
- baz00 3y agoWorth also pointing out that sometimes when you're in a corporate dystopian hell hole do not expect to be able to actually request or install software on your device. What is there is what you have and trying to get it changed is an exercise in taking on the bureaucracy. It's not worth it. Many people have tried and failed. Back in the dark ages, we had a horrible reporting engine in Word VBA that pulled report definitions off a fileshare and cut and pasted bits of templates together and then printed them. Literally there was a computer in the office the IT team hadn't taken back because the guy had quit and we logged it in as one of us and ran that .doc all day to do numerous engineering reports. This was quicker and cheaper than filing a PO for the reporting option on the CAD/CAM software which would have taken at least 18 months, involved consultants and eaten at the project budget. So when everyone bitches about Excel VBA being used for horrible things, the cause is probably further up the stack. The other cause is what I call monkey hammer. If you give a monkey a hammer he's going to hit things. Everything looks like a VBA solution when you're a monkey and the only hammer you have is VBA. I am a slightly more evolved primate these days.
- liotier 3y agoI suspect that dystopian environments of locked-down mandatory corporate Windows laptops with no software installation privileges, firewalled networking and even the USB ports disabled are also part of the reason for every function being crammed into the browser to the point that the browser has become an operating system host... Creativity (and catastrophes) happens where there is freedom: local scripting and browser scripting !
- anthk 3y ago>no software install... https://portableapps.com https://portableapps.com I think there's even a Lazarus IDE available for every company user who wants to create reliable RAD based software bound to corporateware.
- liotier 3y agoDepends on the level of corporate restrictions. Workstations with the "developer" policy applied may do that (if they managed to smuggle the executable through the HTTP proxy, and as long as the program doesn't open an inbound port - upon which event the OS kills it) but others can only run whitelisted executables. Every day I miss the Debian computer I have at home.
- Twirrim 3y agoIt's there, it works. VBA is a very accessible and straightforward language to code in and iterate with. No faffing about with installing external dependencies and library hell, no compilation phase. It's really no surprise that VBA remains invaluable to businesses. I've worked with product managers that use VBA to perform absolutely jaw dropping levels of complicated business analysis, even in environments where they have access to other tools and languages, mature build processes etc, because it's the right tool for the job they have at hand.
- CodeWriter23 3y ago> that doesn't need special (management, management's management, adding to a registrar of projects, budgeting or project manager assigned, etc) Not entirely correct https://www.encomputers.com/2018/05/disable-macros-in-microsoft-office-using-group-policy/ https://www.encomputers.com/2018/05/disable-macros-in-micros...
- kjkjadksj 3y agoA lot of systems have python or perl already installed. I feel like perl in particular is probably way more portable and performant than whatever hacks you have to come up with in excel.
- username135 3y agoSharePoint lists and tables work very well with Access and Excel. Linking them all together is trivial but appears to others as if youve created a magic kingdom of data. Ive gotten far in my career using these oft laughed at tools.
- sancarn 3y agoI do agree, but they do have their limitations. Can't update sharepoint lists from Excel if you have more than 5000 records, can't update sharepoint lists generally unless you use VBA hacks (or use REST API and somehow get VBA to authenticate). I'm not certain whether you can update in bulk using access honestly, I'd be interested in knowing though... Even using REST API has it's own limitations. Generally I update them with client-ran JavaScript. I love sharepoint lists for their ease of use to users, but the limitations are pretty rubbish if ever you want to do anything programatically, unless you can figure out how to authenticate (and/or use a library which handles that for you).