Take the 2-minute tour ×

I use:

retVal = Shell("program.EXE " & filename, vbNormalFocus)

To execute a program need for my excel spreadsheet.

Is it possible to embed the EXE file in the excel file itself?

And how would I execute it then?


1 - Some kind of a bin2str function to turn binary to string (so I can store it in the program as a variable and a str2bin (the oposite)

2 - I read something about OLE Control (that you can embed it there), but I really don't know where to start on this one

share|improve this question
No downvote. Can't you give the external program with the Excel sheet without embedding it in. –  Mudassir Nov 28 '11 at 13:05
Bad behaved user I have to deal with. And I know they wont delete the xls files. Not so sure about any other files I put there. Also easier to distribute –  user590715 Nov 28 '11 at 13:11
You can check for files your program is depending on, and if you don't find any of the files, then inform the user. They have to keep all the components if they wanna use your program. –  Mudassir Nov 28 '11 at 13:13
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
Oh. My. God. This is unholy and makes me want to kill myself. +1 –  Jean-François Corbett Nov 29 '11 at 7:52
@Jean-François I know, makes me queezy too! –  David Heffernan Nov 29 '11 at 8:02
add comment

Your Answer

