A Partiucla work book to hid

sgmpatnaik

Board Regular
Joined
Jul 6, 2012
Messages
75
Hello

i created a workbook with macros and formulas and user forms, it is worked fine for me

my thinking is i want to hide the file when the file is open so i used the below code

Code:
Private Sub Workbook_Open()
Application.Visible = False
UserForm1.Show
End Sub


and in the UserForm1

Code:
Private sub UserForm_Terminate()
Application.Visible = True
UserForm1.Hide
End Sub

so my problem is if i open the more files except that and i open the file then all files are hide but i want to hide only that file where the code is used

kindly give / advise me how to do that

Thanks

SP
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
@Jaafar Tribak

Thanks it working great,

one more request that is when i minimize all excel files and open this particular book then the workbook is hide and user form1 is shows with maximized of the workbooks
so is it possible when i open the particular workbook then the only userform will show and workbooks are minimized

Once again thanks for your replay

Thanks

SP
 
Upvote 0
Maybe this :

Code:
Private Sub Workbook_Open()
    For Each wb In Application.Workbooks
        wb.Windows(1).Visible = False
    Next
    UserForm1.Show
End Sub

Code:
Private Sub UserForm_Terminate()
    For Each wb In Application.Workbooks
        wb.Windows(1).Visible = True
    Next
    ThisWorkbook.Windows(1).Activate
    UserForm1.Hide
End Sub
 
Upvote 0
Sorry I misread your last post .... Try this :
Code:
Private Sub Workbook_Open()
    Dim wb As Workbook
    For Each wb In Application.Workbooks
        wb.Windows(1).WindowState = xlMinimized
    Next
    ThisWorkbook.Windows(1).Visible = False
    UserForm1.Show
End Sub

Code:
Private Sub UserForm_Terminate()
    Dim wb As Workbook
    For Each wb In Application.Workbooks
        wb.Windows(1).WindowState = xlMaximized
    Next
    ThisWorkbook.Windows(1).Visible = True
    ThisWorkbook.Windows(1).Activate
    UserForm1.Hide
End Sub
 
Upvote 0
@Jaafar

Hi

Sorry to give you pain,

it's also do the same work but a little bit change that is when i open the workbook a file is open with no sheets and Show the UserForm1 but when i try to open the another workbook which already open and minimized i can't find the books up to i close the UserForm1

Thnaks

SP
 
Upvote 0
@Jaafar

Hi

Sorry to give you pain,

it's also do the same work but a little bit change that is when i open the workbook a file is open with no sheets and Show the UserForm1 but when i try to open the another workbook which already open and minimized i can't find the books up to i close the UserForm1

Thnaks

SP

Are you refering to my last post ? Also, is you userform shown Modeless ?
 
Upvote 0
Yes, i tried your last post and with that post what happen

first i open 4 books then minimize them then after i open the UserForm Workbook with that a excel file is open and shows the UserForm1 then after i will try to maximize the already minimized books but i can't

kindly suggest is there any mistake with me

Thanks

SP
 
Upvote 0
You can't maximize the minimized workbooks while the userform is being displayed or after the userform is closed ? If you can't maximize the workbooks while the userform is shown then that means the userform is shown Modally .
Try this :
Code:
 UserForm1.Show [COLOR=#ff0000][B]vbModeless[/B][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,203,464
Messages
6,055,571
Members
444,799
Latest member
CraigCrowhurst

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