0

I have created an application which displays UserForm and makes the excel invisible. I have used "application.visible" property however it makes all the excel workbook invisible as well. I just need to make one workbook invisible. Hiding that specific workbook is not working for me as codes don't run in background and gives me an error.

Is there a way wherein I just make the macro containing workbook invisible using application.visible property? The same was what application.visible does but just with one workbook. Please help me.

Community
  • 1
  • 1
P Kumar
  • 1
  • 1
  • 1

1 Answers1

2

ThisWorkbook.Application.Visible = False will change the Visible property of the application running your workbook, i.e. an instance of Excel.EXE ... if this instance is running your other books, too, then as a consequence all these books will disappear from screen.

To hide a single workbook, use

ActiveWindow.Visible = False

or alternatively, if the workbook you want to hide (e.g. "MyWorkbook") is not the active one

Windows("MyWorkbook").Visible = False
skkakkar
  • 2,772
  • 2
  • 17
  • 30
  • Thank You for your answer. Unfortunately, thisworkbook.app.visible is still making all the 2013 excel invisible. my codes doesn't run when I use windows.visible property. I can open a new excel in a new instance of excel thru pressing ALT key which is solving my purpose. Is there a way I can open my saved workbook in new instance of excel.exe likewise i am doing for a new workbook? Thi would also solve my purpose – P Kumar Jul 09 '16 at 07:24
  • @P Kumar I have book1 book2 book3 book4 open. I put the `ActiveWindow.Visible = False` in module of book4 save as xlsm file and then run it. Book4 disapperas whereas book1 book2 book3 remains open. I am not able to get your point. `thisworkbook.application.visible will make all the 2013 excel open files invisible as already stated in my answer. – skkakkar Jul 09 '16 at 07:50
  • @P Kumar Programs in Book3 are executing and as such it is not affected by windows visible property. if you are thinking of working on book4 then why it was necessary to make it invisible. Could you clarify the logic of your execution plan. You will have to set a workbook to nothing before opening a new instance of excel. For your new requirements please put a new question as your original post has been adequately answered. – skkakkar Jul 09 '16 at 08:06
  • Your problems seem to be relating to modal forms Please go through this link[Why does Showing a UserForm as Modal Stop Code Execution?](http://stackoverflow.com/questions/1783906/why-does-showing-a-userform-as-modal-stop-code-execution). – skkakkar Jul 09 '16 at 08:14