Hide only specific workbook without affecting other workbook
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
add a comment |
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
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 |
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
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
edited Nov 21 at 9:32
asked Nov 21 at 5:58
Reymond
125
125
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
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
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
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
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ᴇʜ
20.2k42650
20.2k42650
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
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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