Need help launching and manipulating a compiled Excel file (.exe) using Excel VBA

skengineer

New Member
Joined
Jan 8, 2016
Messages
3
I'm working on a utility to save time / simplify a process of copying and pasting an existing compiled (.exe) Excel file into a new compiled (.exe) Excel template. My idea is to create a separate Excel file that contains VBA code to launch the .exe files and automatically do the copying and pasting. To accomplish this, I need to launch the .exe file, unhide and unlock a tab called 'Info', and then copy and paste info from various cells to the other .exe file.

I found the code on how to open the file; I could use some help getting started on how to unhide and unprotect the tab (it's password protected). Any suggestions would be appreciated!

Sub Runcalc()
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)
End Sub


Thanks in advance
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Welcome to MrExcel,

I'm not understanding what you mean by a "compiled Excel file (.exe)". The Excel application itself is executed from EXCEL.EXE, however Excel Workbooks aren't saved to .exe file format (at least not under normal operations).

The objective that you describe of automating the copying of pasting of cells from one Workbook to another can certainly be done. You can find lots of examples of code on this forum that will help get you started.
 
Upvote 0
Jerry - Thank you for the response!

In this case the files I am working with are compiled. They contain VBA code that I want to hide from customers. They are compiled using a DonEx compiler. So, that throws a monkey wrench into the copy / paste objective.

Thanks,

Sheri
 
Upvote 0
Hi Sheri,

Okay, now I understand. I haven't used the DoneEx XCell compiler before. I found it online and downloaded a trial copy to learn more about that.

Doing some testing, you can open the exe files with VBA using the Shell command similarly to your example like this...

Code:
Sub OpenExeFiles()
 Dim RetVal
 RetVal = Shell("C:\MyFolder\MyCompiledExeFile.exe", 1)
 End Sub

Each file opened this way is opened in a separate instance (Application) of Excel. This makes it more difficult to manipulate the newly opened file, but not impossible.

The DoneEx XCell compiler doesn't appear to support the modifying then re-compiling of an opened .exe file. Is that correct from your experience with it?

So I think you could potentially use VBA to open .exe files, then copy and paste values from another exe workbook; however none of the changes you make in that process can be compiled.

That may be okay if you are just adding constants (not formulas that you are trying to protect). If that's the case though, then there might not be any benefit to copying from one exe to another exe, since you won't be able to copy compiled info from the source file, and even if you could, you won't be able to re-compile it in your target template.

All in all, it would seem much simpler for you do all your processing in un-compiled workbooks, then compile the resulting workbook as the last step.
 
Upvote 0

Forum statistics

Threads
1,215,167
Messages
6,123,401
Members
449,098
Latest member
ArturS75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top