problem hide workbook and show userform

leap out

Active Member
Joined
Dec 4, 2020
Messages
271
Office Version
  1. 2016
  2. 2010
hello

I no know what I'm asking it's possible I search in the internet efficient way to hide workbook and show userform only what I work in my file without effect the rests of files if there are open or open a new file
so what I note for many codes don't treat this problem what I want when I run the file then hide it and show userform and if I run again doesn't open the file at all and if I have another workbook is open , I don't have to open again to show it

short words when open my file hide workbook and show userform without any effects for the rests file whether i open a new workbook or workbook have already opened
if any body has any idea please provide me
thanks
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
See this answer to the same question, which just minimizes the current workbook.

If you want to interact with other worksheets in the background, the userform needs to be in Modeless mode. UserForm1.Show becomes UserForm1.Show vbModeless.

VBA Code:
Sub mrexcel1160509()
    ActiveWindow.WindowState = xlMinimized
    UserForm1.Show vbModeless
End Sub
 
Upvote 0
thanks ,but there are still problem about your code if i open another workbook it shows a workbook contain userform what I work for it , it supposes showing only the userform even i try opening the file again or open another workbook it must show the only userform without effect for it
 
Upvote 0
So you want to show the userform as soon as the workbook opens? Add that code inside the Workbook_Open() function inside of the ThisWorkbook module. Anything in Workbook_Open() will automatically run as soon as the workbook is opened.
 
Upvote 0
I know about it but the problem when I close the userform it shows the workbook
 
Upvote 0
If you use purely the code above, the workbook stays minimized after the userform is closed. There must be something else you are doing to show the workbook again.

Unless we have a massive misunderstanding about what you are looking for. Screenshots or the workbook itself might help??
 
Upvote 0
actually I don't want minimize the workbook what I would hide userform the working only on userform and when I close the userform should close whole file without remain the workbook file is open and if the userform open and if I open another workbook shouldn't open workbook which is relating the userform I work of it
 
Upvote 0
How about something like this :

In the UserForm Module:
VBA Code:
Option Explicit

Private Sub UserForm_Initialize()
    ThisWorkBook.Windows(1).Visible = False
End Sub

Private Sub UserForm_Terminate()
    If Application.Workbooks.Count = 1 Then
        ThisWorkBook.Save
        Application.Quit
    Else
        ThisWorkBook.Close True
    End If
End Sub

Is your userform Modal or Modeless ?
 
Upvote 0
@Jaafar Tribak well done ! my userform in model and if I have open file and I open the file contains userform then show the file is open I would show userform with minimize any file is open it doesn't supposes showing any file is open stay minimizing
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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