Hide only specific workbook without affecting other workbook
up vote
0
down vote
favorite
Already circled the internet and has the same answer that did not work as I wanted to be.
Q: How to hide workbook and show userform without hiding other workbook?
This code is good but hides other workbooks.
Application.Visible = False
This code is bad as it still shows the excel application.
Workbooks("Workbook Name.xlsm").Window(1).Visible = False
Also dont work.
ActiveWorkbook.Visible = False
Lastly, the tool method, going to tools>options>general tab>ignore other application. I dont have this option on my VBA
This is the code I used.
Private Sub UserForm_Initialize()
If Application.Windows.Count > 1 Then
Application.Windows(ThisWorkbook.Name).Visible = False
Else
Application.Visible = False
End If
and in ThisWorkbook module
Private Sub Workbook_Open()
UserForm1.Show
End Sub
excel vba excel-vba
New contributor
add a comment |
up vote
0
down vote
favorite
Already circled the internet and has the same answer that did not work as I wanted to be.
Q: How to hide workbook and show userform without hiding other workbook?
This code is good but hides other workbooks.
Application.Visible = False
This code is bad as it still shows the excel application.
Workbooks("Workbook Name.xlsm").Window(1).Visible = False
Also dont work.
ActiveWorkbook.Visible = False
Lastly, the tool method, going to tools>options>general tab>ignore other application. I dont have this option on my VBA
This is the code I used.
Private Sub UserForm_Initialize()
If Application.Windows.Count > 1 Then
Application.Windows(ThisWorkbook.Name).Visible = False
Else
Application.Visible = False
End If
and in ThisWorkbook module
Private Sub Workbook_Open()
UserForm1.Show
End Sub
excel vba excel-vba
New contributor
1
You ask to hide a specific workbook, but complain it does not hide the application, but also say hiding the appkication is not good as it hides other workbooks... What di you really want? You need to be clear.
– Solar Mike
Nov 21 at 7:02
as the title says, hide the only specific workbook. 1st code hides all workbook, then 2nd code did not hide the excel application.
– Reymond
Nov 21 at 7:22
You state “this code is bad as it still shows the application”, therefore that does not match with your title question...
– Solar Mike
Nov 21 at 7:26
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Already circled the internet and has the same answer that did not work as I wanted to be.
Q: How to hide workbook and show userform without hiding other workbook?
This code is good but hides other workbooks.
Application.Visible = False
This code is bad as it still shows the excel application.
Workbooks("Workbook Name.xlsm").Window(1).Visible = False
Also dont work.
ActiveWorkbook.Visible = False
Lastly, the tool method, going to tools>options>general tab>ignore other application. I dont have this option on my VBA
This is the code I used.
Private Sub UserForm_Initialize()
If Application.Windows.Count > 1 Then
Application.Windows(ThisWorkbook.Name).Visible = False
Else
Application.Visible = False
End If
and in ThisWorkbook module
Private Sub Workbook_Open()
UserForm1.Show
End Sub
excel vba excel-vba
New contributor
Already circled the internet and has the same answer that did not work as I wanted to be.
Q: How to hide workbook and show userform without hiding other workbook?
This code is good but hides other workbooks.
Application.Visible = False
This code is bad as it still shows the excel application.
Workbooks("Workbook Name.xlsm").Window(1).Visible = False
Also dont work.
ActiveWorkbook.Visible = False
Lastly, the tool method, going to tools>options>general tab>ignore other application. I dont have this option on my VBA
This is the code I used.
Private Sub UserForm_Initialize()
If Application.Windows.Count > 1 Then
Application.Windows(ThisWorkbook.Name).Visible = False
Else
Application.Visible = False
End If
and in ThisWorkbook module
Private Sub Workbook_Open()
UserForm1.Show
End Sub
excel vba excel-vba
excel vba excel-vba
New contributor
New contributor
edited Nov 21 at 9:32
New contributor
asked Nov 21 at 5:58
Reymond
93
93
New contributor
New contributor
1
You ask to hide a specific workbook, but complain it does not hide the application, but also say hiding the appkication is not good as it hides other workbooks... What di you really want? You need to be clear.
– Solar Mike
Nov 21 at 7:02
as the title says, hide the only specific workbook. 1st code hides all workbook, then 2nd code did not hide the excel application.
– Reymond
Nov 21 at 7:22
You state “this code is bad as it still shows the application”, therefore that does not match with your title question...
– Solar Mike
Nov 21 at 7:26
add a comment |
1
You ask to hide a specific workbook, but complain it does not hide the application, but also say hiding the appkication is not good as it hides other workbooks... What di you really want? You need to be clear.
– Solar Mike
Nov 21 at 7:02
as the title says, hide the only specific workbook. 1st code hides all workbook, then 2nd code did not hide the excel application.
– Reymond
Nov 21 at 7:22
You state “this code is bad as it still shows the application”, therefore that does not match with your title question...
– Solar Mike
Nov 21 at 7:26
1
1
You ask to hide a specific workbook, but complain it does not hide the application, but also say hiding the appkication is not good as it hides other workbooks... What di you really want? You need to be clear.
– Solar Mike
Nov 21 at 7:02
You ask to hide a specific workbook, but complain it does not hide the application, but also say hiding the appkication is not good as it hides other workbooks... What di you really want? You need to be clear.
– Solar Mike
Nov 21 at 7:02
as the title says, hide the only specific workbook. 1st code hides all workbook, then 2nd code did not hide the excel application.
– Reymond
Nov 21 at 7:22
as the title says, hide the only specific workbook. 1st code hides all workbook, then 2nd code did not hide the excel application.
– Reymond
Nov 21 at 7:22
You state “this code is bad as it still shows the application”, therefore that does not match with your title question...
– Solar Mike
Nov 21 at 7:26
You state “this code is bad as it still shows the application”, therefore that does not match with your title question...
– Solar Mike
Nov 21 at 7:26
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
The correct way to hide one specific workbook is
Application.Windows(ThisWorkbook.Name).Visible = False
where ThisWorkbook.Name
can be replaced with the desired workbook name like "MyWb.xlsm"
.
- If there are more than one workbooks open at the same time this will hide the specified workbook (and its application window).
- If this is the only workbook that is open it will hide the specified workbook (without its application window).
If you want to hide the application window you must use
Application.Visible = False
The trick is now to combine them
If Application.Windows.Count > 1 Then 'more than one workbook open: Hide workbook only
Application.Windows(ThisWorkbook.Name).Visible = False
Else 'only one workbook open: Hide application
Application.Visible = False
End If
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into theUserForm_Activate
.
– Pᴇʜ
Nov 21 at 9:38
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
|
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The correct way to hide one specific workbook is
Application.Windows(ThisWorkbook.Name).Visible = False
where ThisWorkbook.Name
can be replaced with the desired workbook name like "MyWb.xlsm"
.
- If there are more than one workbooks open at the same time this will hide the specified workbook (and its application window).
- If this is the only workbook that is open it will hide the specified workbook (without its application window).
If you want to hide the application window you must use
Application.Visible = False
The trick is now to combine them
If Application.Windows.Count > 1 Then 'more than one workbook open: Hide workbook only
Application.Windows(ThisWorkbook.Name).Visible = False
Else 'only one workbook open: Hide application
Application.Visible = False
End If
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into theUserForm_Activate
.
– Pᴇʜ
Nov 21 at 9:38
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
|
show 3 more comments
up vote
0
down vote
The correct way to hide one specific workbook is
Application.Windows(ThisWorkbook.Name).Visible = False
where ThisWorkbook.Name
can be replaced with the desired workbook name like "MyWb.xlsm"
.
- If there are more than one workbooks open at the same time this will hide the specified workbook (and its application window).
- If this is the only workbook that is open it will hide the specified workbook (without its application window).
If you want to hide the application window you must use
Application.Visible = False
The trick is now to combine them
If Application.Windows.Count > 1 Then 'more than one workbook open: Hide workbook only
Application.Windows(ThisWorkbook.Name).Visible = False
Else 'only one workbook open: Hide application
Application.Visible = False
End If
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into theUserForm_Activate
.
– Pᴇʜ
Nov 21 at 9:38
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
|
show 3 more comments
up vote
0
down vote
up vote
0
down vote
The correct way to hide one specific workbook is
Application.Windows(ThisWorkbook.Name).Visible = False
where ThisWorkbook.Name
can be replaced with the desired workbook name like "MyWb.xlsm"
.
- If there are more than one workbooks open at the same time this will hide the specified workbook (and its application window).
- If this is the only workbook that is open it will hide the specified workbook (without its application window).
If you want to hide the application window you must use
Application.Visible = False
The trick is now to combine them
If Application.Windows.Count > 1 Then 'more than one workbook open: Hide workbook only
Application.Windows(ThisWorkbook.Name).Visible = False
Else 'only one workbook open: Hide application
Application.Visible = False
End If
The correct way to hide one specific workbook is
Application.Windows(ThisWorkbook.Name).Visible = False
where ThisWorkbook.Name
can be replaced with the desired workbook name like "MyWb.xlsm"
.
- If there are more than one workbooks open at the same time this will hide the specified workbook (and its application window).
- If this is the only workbook that is open it will hide the specified workbook (without its application window).
If you want to hide the application window you must use
Application.Visible = False
The trick is now to combine them
If Application.Windows.Count > 1 Then 'more than one workbook open: Hide workbook only
Application.Windows(ThisWorkbook.Name).Visible = False
Else 'only one workbook open: Hide application
Application.Visible = False
End If
answered Nov 21 at 7:31
Pᴇʜ
19.5k42650
19.5k42650
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into theUserForm_Activate
.
– Pᴇʜ
Nov 21 at 9:38
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
|
show 3 more comments
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into theUserForm_Activate
.
– Pᴇʜ
Nov 21 at 9:38
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
Hi, thank you for your kind answer. I try the code, put it in Initialize event and add userform1.show in workbook_open. I open extra workbook then open my working file and did not hide any workbook on the other hand I try to open my working file first before other workbook, other workbook did not shown up.
– Reymond
Nov 21 at 8:11
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
The code should work (I'm not sure what you did wrong). Especially if we don't see how your actual code looks like. Edit your original question, add the code you use and describe exactly what you did. Comments are too short to clarify this question.
– Pᴇʜ
Nov 21 at 8:29
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Hi, I edit the question and show the code I used. Or should I put the code you gave to ThisWorkbook module?
– Reymond
Nov 21 at 9:33
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into the
UserForm_Activate
.– Pᴇʜ
Nov 21 at 9:38
Probably the issue is that the code tries to hide the workbook before it is shown. This could be a timing issue. Maybe try to put it into the
UserForm_Activate
.– Pᴇʜ
Nov 21 at 9:38
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
how I will use UserForm_Activate?
– Reymond
Nov 21 at 10:04
|
show 3 more comments
Reymond is a new contributor. Be nice, and check out our Code of Conduct.
Reymond is a new contributor. Be nice, and check out our Code of Conduct.
Reymond is a new contributor. Be nice, and check out our Code of Conduct.
Reymond is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406065%2fhide-only-specific-workbook-without-affecting-other-workbook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You ask to hide a specific workbook, but complain it does not hide the application, but also say hiding the appkication is not good as it hides other workbooks... What di you really want? You need to be clear.
– Solar Mike
Nov 21 at 7:02
as the title says, hide the only specific workbook. 1st code hides all workbook, then 2nd code did not hide the excel application.
– Reymond
Nov 21 at 7:22
You state “this code is bad as it still shows the application”, therefore that does not match with your title question...
– Solar Mike
Nov 21 at 7:26