Excel Vba Hide Application

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.

Active8 months ago

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.

Community
Abhijit ShelarVbaAbhijit Shelar
4915 gold badges15 silver badges38 bronze badges

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

w5m
1,5253 gold badges20 silver badges38 bronze badges
Siddharth RoutSiddharth Rout
123k15 gold badges163 silver badges218 bronze badges

Not the answer you're looking for? Browse other questions tagged vbaexcel-vbaexcel or ask your own question.

Active4 years, 8 months ago

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

pnuts
51k8 gold badges65 silver badges105 bronze badges
SamraanSamraan
1303 gold badges4 silver badges12 bronze badges

3 Answers

You need to show the UserForm in modeless mode and then hide the application.

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 Rout
123k15 gold badges163 silver badges218 bronze badges

There 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:

hammushammus
2,3011 gold badge14 silver badges33 bronze badges

In case someone wants to run a userform 'alike' a stand alone application:

Issues I was facing:

  1. I did not want to use the Workbook_Open Event as the excel is locked in read only.
  2. 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:

Excel Vba Hide Application Show Form

Flexo
72.7k22 gold badges159 silver badges238 bronze badges
Axn40Axn40

Excel Vba Hide Application Online

Not the answer you're looking for? Browse other questions tagged excelvbaexcel-vbabatch-file or ask your own question.