Rename .exe file with VBA?


#1

Is there a way to rename a .exe file in the same way as original SaveAs function for .xlsm ?


#2

What about Name OldFile As Newfile?


#3

I have an application that consists of a (organisational) template that can be initialised by a user and then becomes a personalised copy of the template. (Using SaveAs which leaves the template as original to use for the next user and saves the initialed version with a new name for use by that user.) I tried SaveSecureWorkbookToFile but that only saves to .xlsc which holds dependancy to the template. I would like to avoid this so that users can work with their copy (on their laptop on road) without taking the template with them. Is there a way to do that or is there no way to clone a secured file after a few changes from original?


#4

What do you mean by that?


#5

I mean that .xlsc file can only be opened through the XLSPadLock secured file (.exe) which is the template in my application. Can I clone a secured .exe file through vba in any way?


#6

Sure, to clone the .exe, just make a copy of it.


#7

I am sorry I can’t get my point across.
I have an application that consists of a template (.xlsm) for Organisational use by several users.
When this template is opened the user can enter their details en click a Setup button.
When clicked the details of the user are used to rename the template and main sheets are enabled.
From then on this copy is used as personal working copy of this user.
I use VBA’s SaveAs command; this renames the template and leaves the template as original for use by the next user to setup its personal copy.

I am after a way to replicate this behaviour with a secured file.
When I compile the the template and provide the license key to the clients administrator I would like that the template (.exe) can be setup by the client’s users as above. How can I arrange that a user can open the template, enter some details and then activate my setup code with a button that arranges a (personalised) copy of the template as .exe file with the changes made and leaves the template as original. From then on I would like that the usercopy (.exe) automatically and saves changes automatically without prompt. All users should be able to work with their own copy without any interference or options to overwrite each others changes.


#8

Instead of using SaveAs, use the “SaveSecureWorkbookToFile” VBA extension to create a modified and secure XLSC file. Then your users can run the EXE again and click “Choose Save” option to open the XLSC file back.
Be sure to upgrade to XLS Padlock 2018 because it has a fix for “SaveSecureWorkbookToFile”.


#9

The disadvantage of that strategy is that users need the template with them when they work on a laptop on road and moreover they can overwrite each others files. Is there a way with VBA to create an .exe file that doesn’t interfere with other copies?


#10

No because .EXE files can’t be modified once built. You can also pass any filename to the “SaveSecureWorkbookToFile” VBA extension. You could ask your users for a filename, or generate a unique one based on current date/time if you don’t want to overwrite existing saves.