Results 1 to 34 of 34

Thread: Binary files inside EXCEL VBA

  1. #1

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Binary files inside EXCEL VBA

    As advanced as it is, often even VBA excel has limitations. To overcome these shortcomings, a communication between an independent application and the excel application is an artifice that can save many automations. For example, faster processing can be done by injecting data using VBA into an external application after which the result can be returned to Excel VBA for further processing. Or, maybe we want to execute a VBA function inside EXCEL at regular time intervals.

    Now the problem arises: what if this .xlsx file (VBA Excel file) needs to be used by a large mass of analysts inside a company? analysts who don't know much about software programming and automation. What do we do? Well, we can't bother them with all the technical details on where different files should pe put in or how the application works. If we do, they will simply reject your automatisation. On the other hand no programmer may wish to explain the "how to" for let's say 1000-3000 individuals, it is not feasible (i.e. resistance to new things, different training backgrounds, and so on).

    The best solution is to give them one EXCEL file like they are used to. This implies that the external application (exe file) must somehow be in the same excel file.

    Thus, this application from below converts any executable file to VBA source code that can be included as a '.bas' module in an EXCEL file. Once inserted into the EXCEL file, the VBA code can be used to completely restore the executable file to disk in the same directory as the EXCEL file. Also, once recomposed on disk, the executable file can be executed automatically. Use the EXCEL file in the "test" directory for experimentation.


    Download: Binary files inside EXCEL VBA


    Name:  scr.jpg
Views: 1115
Size:  52.3 KB

    Name:  excel.jpg
Views: 1145
Size:  34.1 KB

    Name:  hex.jpg
Views: 945
Size:  17.6 KB
    Last edited by Paul A. Gagniuc; Mar 20th, 2022 at 01:42 PM.

  2. #2
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Binary files inside EXCEL VBA

    Please stop posting things that are most useful for malware writers, please delete this and the other almost the same thread.
    Normal programmers don't drop exes, and if someone need to do so, most advanced programmers already have the skills to write that code.
    This kind of code samples can only help scrip kiddies and wannabe hackers.
    TIA.

  3. #3
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    198

    Re: Binary files inside EXCEL VBA

    G'Day Eduardo

    I have been collecting the source code for virus written in many language for 20+ years for desktop and this technique won't get past 99% of virus detectors.

    Quote Originally Posted by Paul A. Gagniuc View Post
    completely restore the executable file to disk
    as it is writing to disk not memory directly.

    Don't want to same anymore about this to help the criminals.

    Plus, this project is in github already, out in the wild

    Are you using TOR, if not get onto DW and you would see much much worse than this avail. HAAS - Hacking as a Serv. !!!

  4. #4
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Binary files inside EXCEL VBA

    The more that VB6 is used for criminal activities, the more that it hurts the (good) VB6 community.

  5. #5
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    198

    Re: Binary files inside EXCEL VBA

    G'Day Eduardo

    Yes mate I understand

    But M$ tried to get rid of VB6 for this reason 15+ years ago and it didn't work.

    I have a friend who was working for M$ back then and a few of the management team said this was like trying to ban guns because criminals use guns !!!

    We cannot stop the criminals, plus we need u to get back to the coding bench and continue on with all of your gr8 coding projects.

    Remember not everyone is Leonardo or Michelangelo, the community would be much better off if you just let go of this concern because it is stopping you being as product as you could be

    Pls. put down your suite case of concern and walk away into the sunset.

    I hope you take this as a compliment not a condescending rant.

  6. #6
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Binary files inside EXCEL VBA

    The reasons why MS abandoned VB6 had nothing to do with this, and yes, we can do something: not to post stuff like this.

    Quote Originally Posted by jg.sa View Post
    We cannot stop the criminals
    No, we cannot stop all criminals, but what we can do is not to help them.

    jg.sa: I'm really not understanding what you are saying, what is your point, if you are in favor or against and of what. Your English is a bit strange, BTW.

    It is for not helping criminals, but it is more about protecting our language and our projects. If VB6 is used for criminal activities more and more, AVs will start to flag as malware any VB6 executable. And that is to some extent already happening.

  7. #7

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Eduardo- View Post
    The reasons why MS abandoned VB6 had nothing to do with this, and yes, we can do something: not to post stuff like this.



    No, we cannot stop all criminals, but what we can do is not to help them.

    jg.sa: I'm really not understanding what you are saying, what is your point, if you are in favor or against and of what. Your English is a bit strange, BTW.

    It is for not helping criminals, but it is more about protecting our language and our projects. If VB6 is used for criminal activities more and more, AVs will start to flag as malware any VB6 executable. And that is to some extent already happening.

    We must avoid finding excuses for mediocre security analysts that confuse VB6 executables with malware, we've been making this excuse for a decade or more. The method presented here is a naive approach to malware, at best. I will argue that this method does not help malware creators. And to be realistic, one can't create malware and be unaware of this method ...

    We can't stop using air for breathing just because air fuels flames. At this point I believe the method is very helpful for advanced Excel VBA automation projects (hybrid projects).
    Last edited by Paul A. Gagniuc; Mar 14th, 2022 at 07:24 AM.

  8. #8
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Binary files inside EXCEL VBA

    Gosh, I'm on the fence on this one.

    Paul seems to be providing us with some really great stuff with no ill intent at all, so I'm hesitant to give him too hard a time.

    Also, I agree that this approach would be a pretty primitive approach to malware. Once someone allows the running of Excel macros, they've opened themselves up regardless of whether some binary executable is exported or not. The VBA can be quite harmful, if someone wishes to do that.

    Also, whatever this binary is, it's got to be "portable" or this approach isn't going to work. Although, I suspect that most email-type viruses are portable.

    IDK, I just don't see any immediate ill-intent here.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  9. #9
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    I myself am not sure how to feel about the potential abuses techniques like this could encourage. However, I am curious as to what legitimate use something like this could have. While I don't doubt OP's honest intentions, this kind of thing smells like malware, primitive as this method of infection is.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  10. #10
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Binary files inside EXCEL VBA

    Truth be told, this whole thread is a bit off-topic, being Excel VBA and all. If we're in VB6, all of this is trivial. Just shove the binaries into the project's resources and unload them from there. It's also twice as efficient (I didn't look but I believe he's using hex), as the direct binary code can be stored in the resources. Not really any secret about that at all.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  11. #11
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    People don't typically put EXEs in a project's resource files.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  12. #12
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    However, after thinking about this further, I realized that there are far more advanced techniques showcased on this site that could be used towards malevolent ends and can be far more dangerous. This one is pretty basic and tame by comparison and as such, it may be acceptable to leave it up though I'd encourage it's use towards storing non executable binaries like images.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  13. #13

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Elroy View Post
    Truth be told, this whole thread is a bit off-topic, being Excel VBA and all. If we're in VB6, all of this is trivial. Just shove the binaries into the project's resources and unload them from there. It's also twice as efficient (I didn't look but I believe he's using hex), as the direct binary code can be stored in the resources. Not really any secret about that at all.
    To my shame, I totally forgot about the project resources. I think I used the project resources once if I vaguely remember this.
    Last edited by Paul A. Gagniuc; Mar 15th, 2022 at 02:20 PM.

  14. #14

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Niya View Post
    I myself am not sure how to feel about the potential abuses techniques like this could encourage. However, I am curious as to what legitimate use something like this could have. While I don't doubt OP's honest intentions, this kind of thing smells like malware, primitive as this method of infection is.
    The point with EXCEL files and embedded executables is that .xlsm can allow for one file applications with no dependencies. I believe the world already craves for that. People have no time for endless instructions and disparate files. There is also a beauty in one file EXCEL applications.

  15. #15
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Paul A. Gagniuc View Post
    The point with EXCEL files and embedded executables is that .xlsm can allow for one file applications with no dependencies. I believe the world already craves for that. People have no time for endless instructions and disparate files. There is also a beauty in one file EXCEL applications.
    Ah well, VBA is not a world I ever played in for any significant time. My last bout with VBA was building programs in Access like 20 years ago. I'll defer to you on this if you think this is an approach VBA users find acceptable.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  16. #16

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Niya View Post
    Ah well, VBA is not a world I ever played in for any significant time. My last bout with VBA was building programs in Access like 20 years ago. I'll defer to you on this if you think this is an approach VBA users find acceptable.
    VBA is the most powerful environment for automation, by far. Many tries to copy the model or to have some variations on it were done over time. None worked as the original.

  17. #17
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Paul A. Gagniuc View Post
    VBA is the most powerful environment for automation, by far. Many tries to copy the model or to have some variations on it were done over time. None worked as the original.

    You should probably qualify that as "internal" automation, because VB6 and other languages can take advantage of the object model exposed by MS-Office products, and then "externally" automate them. I do that extensively with VB6. And it's really the power of programs such as Excel that make all of this so appealing.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  18. #18

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Elroy View Post
    You should probably qualify that as "internal" automation, because VB6 and other languages can take advantage of the object model exposed by MS-Office products, and then "externally" automate them. I do that extensively with VB6. And it's really the power of programs such as Excel that make all of this so appealing.
    Indeed, "internal" automation is the right term here. I have seen this "external" approach done from VB6 and from Python in the past.
    Last edited by Paul A. Gagniuc; Mar 16th, 2022 at 03:09 AM.

  19. #19
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Paul A. Gagniuc View Post
    The point with EXCEL files and embedded executables is that .xlsm can allow for one file applications with no dependencies. I believe the world already craves for that. People have no time for endless instructions and disparate files. There is also a beauty in one file EXCEL applications.
    So you're using Excel as an install tool, or a deployment vector... why not just use an installer? Otherwise you're cutting off a segment of potential users that don't have Excel.

    Quote Originally Posted by Paul A. Gagniuc View Post
    VBA is the most powerful environment for automation, by far. Many tries to copy the model or to have some variations on it were done over time. None worked as the original.
    Quote Originally Posted by Elroy View Post
    You should probably qualify that as "internal" automation, because VB6 and other languages can take advantage of the object model exposed by MS-Office products, and then "externally" automate them. I do that extensively with VB6. And it's really the power of programs such as Excel that make all of this so appealing.
    I'd argue that Exchange is pretty powerful in the automation realm. I've built workflow processes around early Exchange servers and MS Mail (and early Outlook) that automated a number of processes. All it required was for the user to open a mail of a particular type (generating a Mail Form) ... fill it out, and then based on the sender, and other values set, it would automatically route it to the appropriate people ... if it hit someone that was OOO, it bypassed them and went to the next person on the list. If it sat too long in someone's inbox (they went on vacation and forgot to turn on their OOO settings) it would timeout and bypass them. It was pretty cool. All on mid-90's tech too.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  20. #20
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Binary files inside EXCEL VBA

    I think we're all getting a bit carried away here.

    In my primary application (which is portable and needs no installation, but does extensively use SxS for OCXs as well as Trick tricks for loading ActiveX DLLs), in addition to that, I have two little utility programs stuffed into its "resources". One is a video player (based on MPlayer), and the other is a freeware C3D (coordinate 3 dimensions) file reader (actually written by a friend). Those are both portable as well, so I just write them out to a folder in the CSIDL_LOCAL_APPDATA area, and use them when I need them. It's all been working fine for decades.

    Personally, I dislike installers a great deal, but I know there's much debate about that, so, just chalk that up to my personal opinion.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  21. #21
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Binary files inside EXCEL VBA

    And in that case... you can just distribute the file, right? And in that case that would be fine (personally I prefer those kinds of "installs") ...
    But in regards to this thread I guess I'm failing to see what wrapping it up into a module in Excel gets you other that using Excel as a deployment vector.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  22. #22
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by techgnome View Post
    But in regards to this thread I guess I'm failing to see what wrapping it up into a module in Excel gets you other that using Excel as a deployment vector.
    Hi Tech, I don't disagree. For me, Excel would be a horrible software distribution method. However, I'm guessing that Paul does a great deal of his work in Excel's VBA, and possibly had a case where he needed some little utility program (similar to me), and just came up with this method ... and shared it.

    But, I should probably let him speak for himself.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  23. #23
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Binary files inside EXCEL VBA

    You can just use a free utility like ZIP 2 Secure EXE. This goes beyond a simple self-extracting archive with a good set of options. It also produces an EXE having a well known code signature with good reputation, avoiding a lot of problems with "false" positives from anti-malware tools.

  24. #24

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    I added some explanations to the post for a real world context, where the method is needed. Perhaps this could have been helpful from the very beginning.

  25. #25

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Elroy View Post
    Hi Tech, I don't disagree. For me, Excel would be a horrible software distribution method. However, I'm guessing that Paul does a great deal of his work in Excel's VBA, and possibly had a case where he needed some little utility program (similar to me), and just came up with this method ... and shared it.

    But, I should probably let him speak for himself.
    Thank you for the kind words Dr. Sullivan, much appreciate it. Indeed, I have worked with Renault in the past on many automation projects. It baffles the mind on how advanced these kind of VBA projects can get. The work can reach a stage in which one cannot recognize EXCEL anymore. At that level the method shown here is helpful. I added some context in the description of this post, in order to clarify the use of the method:


    As advanced as it is, often even VBA excel has limitations. To overcome these shortcomings, a communication between an independent application and the excel application is an artifice that can save many automations. For example, faster processing can be done by injecting data using VBA into an external application after which the result can be returned to Excel VBA for further processing. Or, maybe we want to execute a VBA function inside EXCEL at regular time intervals.

    Now the problem arises: what if this .xlsx file (VBA Excel file) needs to be used by a large mass of analysts inside a company? analysts who don't know much about software programming and automation. What do we do? Well, we can't bother them with all the technical details on where different files should pe put in or how the application works. If we do, they will simply reject your automatisation. On the other hand no programmer may wish to explain the "how to" for let's say 1000-3000 individuals, it is not feasible (i.e. resistance to new things, different training backgrounds, and so on).

    The best solution is to give them one EXCEL file like they are used to. This implies that the external application (exe file) must somehow be in the same excel file.

    Thus, this application from below converts any executable file to VBA source code that can be included as a '.bas' module in an EXCEL file. Once inserted into the EXCEL file, the VBA code can be used to completely restore the executable file to disk in the same directory as the EXCEL file. Also, once recomposed on disk, the executable file can be executed automatically. Use the EXCEL file in the "test" directory for experimentation.
    Last edited by Paul A. Gagniuc; Mar 20th, 2022 at 02:11 PM.

  26. #26
    Member
    Join Date
    Apr 2019
    Posts
    63

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Niya View Post
    Ah well, VBA is not a world I ever played in for any significant time. My last bout with VBA was building programs in Access like 20 years ago. I'll defer to you on this if you think this is an approach VBA users find acceptable.
    Can confirm, I've done this in the past. Especially when using DLLs like Webview2.dll, MITAB.dll, blas.dll etc.

    Quote Originally Posted by techgnome View Post
    So you're using Excel as an install tool, or a deployment vector... why not just use an installer? Otherwise you're cutting off a segment of potential users that don't have Excel.
    Unfortunately, not everyone has the capability of running msi's on their computer. VBA is highly common in businesses where users aren't able to run installers like you suggest. In these scenarios using VBA as an installer is super ideal. Bare in mind typically in these cases EXEs will also be unable to run, so the primary use case is installing DLLs in my opinion.
    Last edited by sancarn; Mar 25th, 2022 at 05:09 AM.

  27. #27
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by sancarn View Post
    Can confirm, I've done this in the past. Especially when using DLLs like Webview2.dll, MITAB.dll, blas.dll etc.



    Unfortunately, not everyone has the capability of running msi's on their computer. VBA is highly common in businesses where users aren't able to run installers like you suggest. In these scenarios using VBA as an installer is super ideal. Bare in mind typically in these cases EXEs will also be unable to run, so the primary use case is installing DLLs in my opinion.
    That has got to be an IT nightmare...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  28. #28
    Member
    Join Date
    Apr 2019
    Posts
    63

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by techgnome View Post
    That has got to be an IT nightmare...
    Yes, unfortunately, for both parties. A nightmare for users because they are left to maintain applications in archaic programming languages like VBA. And a nightmare for IT because Mike from accounting has retired and now IT need to maintain his archaic VBA project

  29. #29

    Thread Starter
    Lively Member Paul A. Gagniuc's Avatar
    Join Date
    Feb 2022
    Location
    Romania, Bucharest
    Posts
    65

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by sancarn View Post
    Yes, unfortunately, for both parties. A nightmare for users because they are left to maintain applications in archaic programming languages like VBA. And a nightmare for IT because Mike from accounting has retired and now IT need to maintain his archaic VBA project
    I wish to add that VBA is made in the past, but is far from archaic. New applications are made in it. Actually I will dare to say it is way superior to many "moden" scripting languages.

  30. #30
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Paul A. Gagniuc View Post
    Actually I will dare to say it is way superior to many "moden" scripting languages.
    First class functions, Async/Await and a straightforward multithreading API, I haven't touched VBA in eons but if the language doesn't support at least one of these then I'd hesitate to call it modern. Nearly all respectable modern languages have all of these.
    Last edited by Niya; Mar 25th, 2022 at 12:11 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  31. #31
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Paul A. Gagniuc View Post
    I wish to add that VBA is made in the past, but is far from archaic. New applications are made in it. Actually I will dare to say it is way superior to many "moden" scripting languages.
    I agree. What is archaic is the VBA IDE and because it lacks of some modern technologies like Niya pointed, but not the language.

  32. #32
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Eduardo- View Post
    I agree. What is archaic is the VBA IDE and because it lacks of some modern technologies like Niya pointed, but not the language.
    A better IDE is definitely a must but a lot of modern language features are actually implemented in the compiler. For example, Async/Await is possible due to some very advanced wizardry in modern compilers.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  33. #33
    Member
    Join Date
    Apr 2019
    Posts
    63

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by Niya View Post
    First class functions, Async/Await and a straightforward multithreading API, I haven't touched VBA in eons but if the language doesn't support at least one of these then I'd hesitate to call it modern. Nearly all respectable modern languages have all of these.
    This. I love VB6/VBA, but I have to agree with this. Other mistakes in my opinion:

    • Lack of lambda expressions
    • Lack of low-level object pointers (even if the pointer was to a slug containing the objptr and used IDispatch calls)
    • Lack of easy ability to implement IEnumVARIANT (or rather the lack of an alternative means to get `for each ... in ...` working) (p.s. i know libraries have made this easier)
    • Lack of easy ability to implement system interfaces (related to above) (p.s. i know libraries have made this easier)
    • Lack of ability to alias types (not a must have but very much a nice to have)


    And to be honest you just need to look at TwinBASIC to see what's missing from VB6/VBA...

    So all in all, yes, legacy/archaic and outdated. If we all had Ruby/Python installed on our machines by default, I'm pretty sure most companies would use those languages instead, apart from for very small applications where integration with Excel/Powerpoint/Word events is required.
    Last edited by sancarn; Mar 25th, 2022 at 01:25 PM.

  34. #34
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Binary files inside EXCEL VBA

    Quote Originally Posted by sancarn View Post
    [*] Lack of easy ability to implement IEnumVARIANT (or rather the lack of an alternative means to get `for each ... in ...` working) (p.s. i know libraries have made this easier)
    This one is quite interesting. Modern languages have some pretty interesting ways of handling collections. For example in Python one can do this:-
    Code:
    names = ["John","Keston","Mary","Luis"]
    
    enumerable = iter(names)
    
    print(next(enumerable))
    
    print(next(enumerable))
    
    print(next(enumerable))
    
    print(next(enumerable))
    You can also do stuff like this:-
    Code:
    def namesGenerator():
        yield "John"
        yield "Keston"
        yield "Mary"
        yield "Luis"
    
    for n in namesGenerator():
        print(n)
    Both versions of the above produces this output:-
    Code:
    John
    Keston
    Mary
    Luis
    Even VB.Net supports this:-
    Code:
    Module Module1
        Sub Main()
    
            For Each n In namesGenerator()
                Debug.WriteLine(n)
            Next
    
            Console.ReadKey()
    
        End Sub
    
        Private Iterator Function namesGenerator() As IEnumerable(Of String)
            Yield "John"
            Yield "Keston"
            Yield "Mary"
            Yield "Luis"
        End Function
    End Module
    You can even combine it with another modern feature, anonymous functions:-
    Code:
    Module Module1
        Sub Main()
    
            Dim namesGenerator = Iterator Function()
                                     Yield "John"
                                     Yield "Keston"
                                     Yield "Mary"
                                     Yield "Luis"
                                 End Function
    
    
            For Each n In namesGenerator()
                Debug.WriteLine(n)
            Next
    
            Console.ReadKey()
    
        End Sub
    End Module
    Aside from Python and VB.Net, all of these are also supported in Java, JavaScript, C#, PHP, Perl and Ruby just to name a few of the more popular languages. VBA has quite a ways to go to be considered a modern language.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width