Embed EXE file in the Excel file Embed EXE file in the Excel file vba vba

Embed EXE file in the Excel file


Here's an outline solution that avoids OLE:

  1. Create a hidden worksheet.
  2. Use a base 64 encoded to convert the exe to text.
  3. Store that text in worksheet cells on the hidden worksheet. Since there is a limit on the number of characters in a cell (32,767) you will need to break the string into chunks.

Obviously you'll need to reverse this procedure when you want to save and execute the exe file.


You can do this by using: Insert > Object and then selecting 'Create from File'.

To add it to your sheet using VBA:

Dim o As OLEObjectSet o = ActiveSheet.OLEObjects.Add(Filename:="C:\program.exe")

Then this is the command to execute program.exe:

o.Verb Verb:=xlPrimary

Not sure how to pass arguments to it, however (e.g. your filename).

Note: Untrusted applications prompt a warning when you run them.