Sub openform Application.Visible = False UserForm1.Show vbModeless End Sub and either in a button you need to set it back to true or you can use the UserFormQueryClose event. Private Sub UserFormQueryClose(Cancel As Integer, CloseMode As Integer) Application.Visible = True ThisWorkbook.Close SaveChanges:=False End Sub. Hiding active workbook programmatically in Excel. I'm working on a VBA project based in a workbook. The code opens a new workbook and calls an external API which downloads and inserts a bunch of data in multiple worksheets of this new workbook. I deactivated Screen Updating ( Application.Screenupdating = False) so initially.
Is it possible to hide VBA code, normally accessible from Excel's VBA Editor (Alt-F11), from a user's prying eyes? Can I, for instance, sign it with a digital signature?
Standard VBA project password protection is not suitable in this case because it can be cracked relatively easily.
1 Answer
Yes. In the VBA main menu, click on Tools | VBAProject Properties and under the tab 'Protection', Check the box 'Lock project for viewing' and enter the password.
Save and exit the Excel file. When you open it next the code will be hidden.
Sid
w5mNot the answer you're looking for? Browse other questions tagged vbaexcel-vbaexcel or ask your own question.
I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach :
I have written a macros to open the UserForm1
In batch File:
By the above approach, When I'm running the batch file both UserForm1 and excel are getting open, but I want to open only UserForm1. Kindly help me out
pnuts3 Answers
You need to show the UserForm
in modeless
mode and then hide the application.
try this
and either in a button you need to set it back to true or you can use the UserForm_QueryClose
event
Excel Vba Hide Application Free
Siddharth RoutSiddharth RoutThere are several reasons (such as unhandled exceptions crashing your code before Application.Visible
is reset to True
) that it is not a good idea to do this but I'll assume you have considered these:
In case someone wants to run a userform 'alike' a stand alone application:
Issues I was facing:
- I did not want to use the Workbook_Open Event as the excel is locked in read only.
- The batch command is limited that the fact that (to my knowledge) it cannot call the macro.
I first wrote a macro to launch my userform while hiding the application (based on your comments above):
I then created a vbs to launch this macro (doing it with a relative path has been tricky):
And I finally did a batch file to execute the VBS...
Note that I have also included the 'Set back to visible' in my Userform_QueryClose
: