Create a likewise app with excel vba (workbook hidden)

filipe colomb

New Member
Joined
Aug 3, 2015
Messages
40
Hello,

I have some userforms that was build in a app like way, where the user can see data, close and open windows and input data, everything using the userforms. These data are stored in some worksheets and then processed with vba.

I was wondering how can I "transform" it in a app like system, where the user doesn't even know that there is an excel behind it.

I don't know how to fit the Application.visible command, since it work for every opened instances and the user often open other excel files during the use.

I was looking for something that when I open the file I see only the initial userform and when I close it the whole "app" is closed, without messing with other excel files?

Thank you.
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

Paste below code in Userform Code:
Code:
Private Sub UserForm_Initialize()
With Application
        .WindowState = xlMaximized
         Zoom = Int(.Width / Me.Width * 80)
         Width = .Width
         Height = .Height
    End With
End Sub
Private Sub UserForm_Terminate()
If Application.Windows.Count = 1 Then
    Application.DisplayAlerts = False
    ThisWorkbook.Save
    Application.DisplayAlerts = True
    Shell ("taskkill /IM EXCEL.exe")
Else
    Application.DisplayAlerts = False
    ThisWorkbook.Save
    Application.DisplayAlerts = True
    ThisWorkbook.Close
End If
End Sub

This will enable you to open the userform in Full screen mode. You can change the zoom parameters according to the screen.

When you close the userform with cross sign, it will close the whole workbook. Pretty much like a app.

But users can still see the worksheets by disabling macros. You can prevent it by setting the Visible property of worksheets in VBA project sidebar to xlsheetveryhidden.

Hope this helps.
 
Upvote 0
Thank you for the reply Ombir. I will try doing it. Just a doubt, once I make that, the user will be able to use other excel files normally? Or this code you mess up the other instances?
 
Upvote 0
Thank you for the reply Ombir. I will try doing it. Just a doubt, once I make that, the user will be able to use other excel files normally? Or this code you mess up the other instances?

Hi,

You won't be able to use other workbooks as long as Userform is displayed on screen. There are two workarounds.


1. You can Open another instance of excel by using command Excel.exe /x in run window and then open other workbooks in that instance.

2. You need to call window API functions to add minimize button to your Userform. Check below link for this.

http://www.mrexcel.com/forum/excel-...ton-excel-form-visual-basic-applications.html
 
Upvote 0

Forum statistics

Threads
1,225,482
Messages
6,185,262
Members
453,283
Latest member
Shortm88

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