PDA

View Full Version : Userform Standalone/Hide Excel Application



Pencilvester
05-01-2017, 11:19 PM
Hello everyone, I am relatively new to VBA and would greatly appreciate some help. I know there are other related questions to this one, though none of the ones I found solved my problem.

I am developing a Excel VBA Database and Managing System and I would like to hide the excel application while the database is running (only showing the Userforms), and whether I open another excel files it makes the application visible again.
First I used:

Sub workbook_open()

Application.Visible = False

End sub

Sub Workbook_beforeclose(Cancel as Boolean)

Application.visible = True

End subThe problem with this is that when I have this specific program/database running it will unable me from simultaneously using excel for other files if I want.
I tried to come up with a solution which would be:

Sub Workbook_Open()

If Workbooks.count > 1 then
Application.visible = true
Application.windows("mydatabase.xlsm").visible = false

Else
Application.Visible = False
SplashUserForm.Show (vbModeless)
End IfWith this I thought of making the application visible and the specific workbook (mydatabase) invisible, and once others workbook close if there is only the specific workbook open (mydatabase) it would go back to application.visible = false.
This was the solution I found, but I am having problems in executing this code, as once it opens a second workbook (random excel file) it makes the application visible again but doesn't make the specific workbook (mydatabase) invisible.
Someone would know how I could execute this code ? or an alternative solution for my problem ?
And the reason I want to hide the excel workbook is to make it look as a standalone program, with its own interface and have a more unique feel to it rather than having a workbook or excel interface in the background.

Thank you very much!