VBA references in exe - vba

I recently made an Excel-tool, which makes heavy use of VBA macros.
This tool works perfectly on my pc, and on most of my colleagues pc's, but I noticed that it doesn't work on some other pc's. This is because some of the required reference files are not present on those pc's.
I would like to solve this by making an exe-file of the original Excel document, in which all the referenced files are included. I already tried this with Winrar, but I noticed that, after unpacking the exe, the reference files are unpacked in the folder in which the exe file was copied, but not in the required system folders.
How can I fix this, so that I can use the tool on whichever computer I'd like to?
Thanks in advance!
Kind regards,
Marc

Michael Todd's comment about licensing is something worth checking up, but assuming that's ok, you could just write a simple batch file and/or script to first unrar the files and then copy them into the relevant directories. This script would preferably be executed during installation of your excel document.
However, depending on what files they are I'd would be wary of copying them into system directories. Firstly, will you have permissions to write to those directories? Secondly, is it possible that you'll overwrite other versions of those dlls, possibly overwriting a newer version with an older version. Depending on what DLLs you're trying to copy, you might break other applications or even Windows itself by copying them in.
In general, if the solution to your problem is to copy random dlls from your machine to someone else's machine, you should look for an alternative solution. I'd suggest that the better solution might be to change your application to not reference those dlls, or if that can't be done, do a proper install of the application where those dlls come from on the machines where you have the problem .

Just to be sure:
Winrar shows something like this:
and you should be selecting either "Store full paths" (better) or "Store full paths including drive letter" (worse)

I highly recommend you try Inno Setup. It has a higher initial learning curve, but it is well worth it for the enhanced functionality over WinRAR (for this type of thing). Inno-Setup creates installers from plain-text setup files, however, the "Quick Start Pack" includes a GUI front-end for making this part easier.

Related

Install file with the same name on different OS's

I have a question about the rules organizing resources into components.
What I want to do is the following; There are two files (both 64bit) with the same filename but in different source locations and with different component GUID's;
C:\data\win7\driver.sys
C:\data\win10\driver.sys
I want both included in the installer and when the installer runs decide depending on the OS which of these two files will be installed in the same location:
C:\Program Files\MyProgram\driver.sys
Is this a violation of the rules regarding the components? (the main one applying would be the first one I would say:)
"Never create two components that install a resource under the same name and target location. If a resource must be duplicated in multiple components, change its name or target location in each component. This rule should be applied across applications, products, product versions, and companies."
https://learn.microsoft.com/en-us/windows/desktop/Msi/organizing-applications-into-components
Actual Answer: Yes, installing different files to the same absolute path is indeed a violation of the MSI component rules - in
theory. As you have discovered reading the documentation. However,
seeing as only one file will make it onto the box, it is all semantics
really, there will never be two files installed. Still, the MSI will
probably not validate - you will see validation errors.
I am not sure of the technical implications, but could you make the
file name different based on OS? Then you simply put the files in
separate components and use different component GUIDs and condition
the component for installation or not. Full compliance instantly.
With all that said, it seems driver files are to be installed using
INF-files in standalone packages in the future. Please read below.
Component Rules, Pragmatically: This is a well-known problem indeed. I have this old answer that might be helpful: Change my component GUID in wix? It describes how the component rules work in practice, and how the idea is that you reference count an absolute path, and not a file per-se. Please read it to make it clearer. More links in this answer.
Driver Installation: We are supposed to know how to do this, but the rules keep changing (and another answer). Essentially drivers are to be distributed via Windows Update, or at least via a standalone package without the need for an installer in the future (until Microsoft change their mind again?). Windows Hardware Dev Center dashboard. As far as I understand the installation is INF-based (as before).
Question: Are you sure about that installation location? What does the documentation say? I thought sys files should go primarily to the Windows folder? Or the WinSxS folders (side-by-side win32 assemblies). As you understand driver installations confuse us all.
Windows 10 Detection: It appears to be a challenge to detect Windows 10 due to the new "evergreen versionlessness" of Microsoft. I have this old answer written up to summarize my current understanding of it: Windows 10 not detecting on installshield. Deployment tools such as Advanced Installer does the job for you and detects Windows 10 with simple measures. Not sure what Installshield does. The linked answer lists a few approaches to detect the version yourself - not sure which is the saner approach. Please read (and also please report any interesting findings when you have a successful package).

VSTO version 40820 download link

Where I can download VSTO Office Runtime version 10.0.40820?
I need link for this specific version, NOT for the newest one (http://go.microsoft.com/fwlink/?LinkId=158918).
Why I need this specific version? I created custom InstallShield .PRQ for VSTO that download file from web and checks if file is not corrupted using MD5 hash.
If I use generic download link and MS will deploy new version of VSTO then setup will complaint about corrupted file.
InstallShield has abstractions in their PRQ file that are meant to help but I have found problematic.
First, the PRQ itself can have a URL. This means that at runtime the PRQ embedded into the setup.exe will go try to download a newer version of itself from this URL. If this happens, the new XML is used and yours is ignored. This sounds like a good idea to keep things fresh and up to date but the CM Nazi in me see's this as a man in the middle vunerability that compromises the integrity of the build.
The second is that your XML or the downloaded XML both have URL attributes on the individual files. Again the CM Nazi in me says that while this seems like a good idea, it's really inserting an external dependency that isn't under my control and again violating the integrity of the build.
If it was me, I'd never use InstallShield and/or Microsoft URL's in my PRQ files. Host the content yourself and do change management of that so you can have complete control. If longevity of the build is desired then don't use web downloads in the first place. Bake it all into the EXE.
As for the exact question you asked, I'll have to google for it. But really I'd probably just move onto the latest version and then implement the above advice starting there.

Making an updates manager module for a program

I'm working on a program that shall have an "updates" module (online). I can't figure out how to do this. Initially i'm trying with a SVN repository. Any better idea? How is this normally done?
(I'm not asking for a concrete languague, i only want an general idea about the procces)
Thank you.
What we do (in an intranet environment) is roughly:
We have an application that (instead of directly starting) points to a little script that fetches the latest 'publicized' version from a known location using rsync.
Then the script simply bootstraps the application itself.
This way:
Everyone always works with the same version of the software.
New builds are easy to deploy: just copy them over to the known 'sync' location.
Using rsync or similar allows you to minify overhead since it works incrementally.
We force the upgrade upon our users, but this mechanism could also be adapted for online (on-demand) updates.

Cocoa - How to copy files to /usr/share?

I'm developing an "installation" like cocoa application wich needs to take care of some http request, some file system reading, copying files to /usr/share, set up cron (not launchd) and ask some information to user.
I discarded PackageMaker since I need more flexibility.
Currently everything is going well, but on my last installation step, I need to:
Delete my previously installed application folder (if exists). It's always the same path: /usr/share/MY_APP
Create again the application folder at: /usr/share/MY_APP
Copy application files to /usr/share/MY_APP
Update a cron job
It's very important that /usr/share/MY_APP keeps protected with administrative privileges, so a regular shouldn't delete it.
What would be the best approach to implement those steps?
BTW, I'm using Xcode 3.2.
Thanks a lot!
Carlos.
Between the preflight script, the postflight script, and perhaps an Installer plug-in for the custom UI, I see no reason why you can't do all of this in PackageMaker.
Note: “Installer plug-in” is a little misleading. The user does not have to install the plug-in somewhere as a separate step; you include the plug-in inside your package, and Installer will use it from there.
The relevant document is a ReadMe file in a sample code project. There's also an Installer plug-in project template in Xcode since 2.0.
Also, an Installer plug-in won't get used if the user does a command-line installation. Of course, they can't install from the command line at all (which includes remote installation onto an office or lab full of machines) if you write your own custom installer.
By the way: Why /usr/share? What are you putting there? There may be a better way to do what you're really trying to accomplish.

Multiple IDE project files

We are currently working in a team where we use both Visual Studio and Code::Blocks, is there a way to replicate changes between those project files? So if one adds a file to the project file it will also get adjusted in the project file of the other IDE?
Please note: We want our project to work on multiple IDE's, platforms and compilers. Thus a general solution is welcome too.
I assume you're using a VCS? If so my intuition would be to write a script that syncs up your project files (based on modification date?) and run it as a checkin hook if any of the project files are changed in the commit.
http://wordaligned.org/articles/a-subversion-pre-commit-hook
Well this sounds like exactly the type of problem CMake was created to solve. There is definitely a learning curve which I blame mainly on the obtuse documentation but CMake is used in a lot of open source projects now, such as KDE, OGRE and many, many others so there are a lot of usage examples out there. There is also a basic tutorial here.
CMake uses it's own syntax (which is fairly complex though still easier than autotools in my opinion) which is used with project file generators, which supports make, visual studio, codeblocks, eclipse and possibly others. It also has a installer generator which can make NSIS installers, Mac OS X bundles and debian/red hat packages (and again, possibly others) which I find quite useful.