Excel application flashing before hiding when using Application.Visible propety

Shameem Khan

New Member
Joined
Aug 9, 2020
Messages
8
Office Version
  1. 2013
Platform
  1. Windows
I am trying to open a Userform without opening excel application. After some searching, I found the codes to do that. It is working fine, however the Excel window always opens before it hides. Is there anyway to avoid flashing of the excel window so that only the userform shows up and nothing else. I have set the following code inside ThisWorkbook object in Excel VBA.

Private Sub Workbook_open()
Application.Visible = False
Application.ScreenUpdating = False
Uf_Randomizer.Show vbModeless
End Sub

Please help, Thanks in advance.

P.S- I am new to this
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
L

Legacy 456155

Guest
TTBOMK, you will need to create a launcher such as a script file or exe. Before going that far, create a shortcut to your document and select Minimized for the Run option. Maybe that will do...

1596985581326.png
 

Shameem Khan

New Member
Joined
Aug 9, 2020
Messages
8
Office Version
  1. 2013
Platform
  1. Windows
Thanks @dataluver . Not actually what I was looking for, but Good Idea. And what did you mean by creating a launcher. Did you mean to create a batch file(.bat) file to open the excel file or is there any way to convert the excel file into exe file ? Just curious....
 
L

Legacy 456155

Guest
Hi Shameem. In this example, the script file will be in the same folder as the workbook. When you fire up an instance of Excel as an automation server, the default is an invisible application instance. So it will never show unless you explicitly show it. As a side, there may be a command line argument that will work for you. That may be an option worth checking into.

There is an example of the following in this folder which contains a folder named Launch Invisible Instance which, in turn, contains the three files mentioned below. Download the folder as is.

Create a macro enabled workbook with UserForm1 containing this code:
VBA Code:
Private Sub UserForm_Terminate()
    Application.Quit
End Sub

Place this code in your workbook class:
VBA Code:
Private Sub Workbook_Open()
    UserForm1.Show
End Sub

Create a script file. Launcher.vbs, for example:
VBA Code:
Dim fso, FolderName, xl
Set fso = CreateObject("Scripting.FileSystemObject")
FolderName = fso.GetParentFolderName(Wscript.ScriptFullName)
set xl = CreateObject("Excel.Application")
xl.Workbooks.Open FolderName & "\Example Launcher.xlsm"

If you wish, you can then create a shortcut to your script file, changing the icon of the shortcut to suit.
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,126,939
Messages
5,621,719
Members
415,853
Latest member
Newlife72

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
Top