none
Its regarding Hiding / Making the specific excel file invisible or hidden RRS feed

  • Question

  • I have used the following VBA code :

    'Workbooks("Budget.xlsm").Windows(1).Visible = False

    'Windows("Budget.xlsm").Visible = False

    Application.Visible = False

    The problem with the above code is that it makes all the opened excel file invisible and not the one I required.

    Also neither I can work nor I can open any other excel file using those commands.

    Could you please help me out on this.

    Wednesday, January 28, 2015 11:10 PM

Answers

  • Hi

    If you use this > 'Workbooks("Budget.xlsm").Sheets(1).Visible = False

    That will hide only Sheet 1

    Take note that you can go in the menu and unhide that sheet.


    Cimjet

    Wednesday, January 28, 2015 11:53 PM
  • I'm using Excel 2003 and not sure if newer version work the same way but I place this script in "ThisWorkbook" Module

    Private Sub Workbook_Open()
    UserForm1.Show
    Workbooks("Userform.xls").Windows(1).Visible = False
    End Sub

     The Workbook itself is open but all ths sheets are hidden, just the Userform is visible plus I can open a new workbook and it's not hidden.

    I believe you can't hide fully the workbook and have the Userform visible but I could be wrong.

    See if anyone else can shed some light.


    Cimjet


    Thursday, January 29, 2015 4:34 PM
  • In the Userform properties,"Show Modal" should be False.


    Cimjet

    Thursday, January 29, 2015 4:49 PM

All replies

  • Hi

    If you use this > 'Workbooks("Budget.xlsm").Sheets(1).Visible = False

    That will hide only Sheet 1

    Take note that you can go in the menu and unhide that sheet.


    Cimjet

    Wednesday, January 28, 2015 11:53 PM
  • I am now using this

    Application.Visible = False

    What I need is...when I open up the required excel file a userform is displayed and my required excel file should be invisible.

    The problem with the above code is that it makes all the opened excel file invisible and not the one I required.

    Also neither I can work nor I can open any other excel file using that command.

    Could you please help me out on this.

    Wednesday, January 28, 2015 11:56 PM
  • I'm not sure I understand, why can't you use the code I gave you and change the "Sheet1" for the name of the sheet you want to hide.                                        'Workbooks("Budget.xlsm").Sheets(1).Visible = False

    Cimjet

    Thursday, January 29, 2015 12:06 AM
  • Hi Cimjet,

    Thanks for your reply... however I want the required excel file/workbook to be invisble / hidden and not just the sheet.

    I hope I am clear this time.

    Again, the main problem with the code(Application.Visible = False) is that it makes all the opened excel file invisible and not the one I required.

    Also neither I can work nor I can open any other excel file using that command.

    Could you please help me out on this.

    Thursday, January 29, 2015 3:41 PM
  • I'm using Excel 2003 and not sure if newer version work the same way but I place this script in "ThisWorkbook" Module

    Private Sub Workbook_Open()
    UserForm1.Show
    Workbooks("Userform.xls").Windows(1).Visible = False
    End Sub

     The Workbook itself is open but all ths sheets are hidden, just the Userform is visible plus I can open a new workbook and it's not hidden.

    I believe you can't hide fully the workbook and have the Userform visible but I could be wrong.

    See if anyone else can shed some light.


    Cimjet


    Thursday, January 29, 2015 4:34 PM
  • Hi Cimjet,

    Thanks... I am using Excel 2013 version

    however I guess the code should be

    Private Sub Workbook_Open()

    Workbooks("Userform.xls").Windows(1).Visible = False  /*workbook command first

    UserForm1.Show    /* Userform line 2nd
    End Sub

    Besides, the above code doesn't allow me to open another excel file also it doesn't allow me to work on the other excel file while my userform is open.

    Do you know why?

    Thanks

    Thursday, January 29, 2015 4:40 PM
  • In the Userform properties,"Show Modal" should be False.


    Cimjet

    Thursday, January 29, 2015 4:49 PM
  • I will try this and will let you know...thanks a lot
    Thursday, January 29, 2015 5:03 PM
  • Hi Cimjet,

    The code works...thanks for that...

    The new issue is ...when i move ahead with my userform say from userform1 to userform2....then my excel file gets visible (Is there a way to hide the required file till the time I am working on userform)

    Thanks again

    Thursday, January 29, 2015 5:18 PM
  • Re:  Workbook visibility

    There is an option not mentioned so far ...

       Workbooks("Budget.xlsm").IsAddin =True    ' hides workbook
       Workbooks("Budget.xlsm").IsAddin = False  ' shows workbook

    '---

    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Edited by James Cone Tuesday, November 1, 2016 1:03 AM update link
    Thursday, January 29, 2015 11:06 PM
  • Keep in mind, I don't know your application and I could be on the wrong track.

    I made a sample file at the link below, it was made fast, just to see and I can't see your problem.

    The workbook as two userform, you can open a new workbook, close the first userform that will open the second userform, work on the second workbook,close the second userform, and I'm out of idea. It works for me. Have a look at the sample file.

    http://dropcanvas.com/oy4gw

    Have a look at Jim Cone's post also

    P.S. I'm often out and not sure when I'm back.


    Cimjet



    • Edited by Cimjet Friday, January 30, 2015 1:31 AM
    • Proposed as answer by Cimjet Monday, February 2, 2015 2:55 PM
    • Unproposed as answer by Cimjet Monday, February 2, 2015 11:29 PM
    Friday, January 30, 2015 1:29 AM
  • Hi Jim,

    I tried using your code...there is a new problem...My application works like this..    I ask the user the put in the data using userform which is then inserted to the same excel file (Budget.xlsm).

    Now if I use Workbooks("Budget.xlsm").IsAddin =True    ' hides workbook

    this code it made the file hidden but my code then does not recognize the file

    Dim File As String
    File = "Budget.xlsm"

    Windows(File).Activate  /' this is the place where i get the error


    Regards, Hitesh

    Monday, February 2, 2015 9:17 PM
  • Re: trying to activate a hidden workbook (Addin)

    A hidden workook can never be active and does not have a window to activate.

    If you want to do something to/with a hidden workbook then reference the workbook and the approriate sheet...
       Workbooks("Budget.xlsm").Worksheets("Sludge").Range("B4").Value = "Mud"
    The above works whether the workbook is hidden or visible.

    If you want to "see" the workbook then set the IsAddin property to False.
    '---
    Jim Cone
    Tuesday, February 3, 2015 1:26 AM
  • Hi Cimjet,

    The link does not seem to work


    Regards, Hitesh

    Wednesday, February 4, 2015 8:32 PM
  • Hi Cimjet,

    I have used your code

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    for my excel file....But the problem now is that

    My values for combo box are in the Budget.xlsm file and since the

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    is now invisible ...the combo box have no values in it.

    Could you please help me with this


    Regards, Hitesh

    Wednesday, February 4, 2015 9:33 PM
  • Hi Jim,

    I am now using the code given by Cimjet

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    for my excel file....But the problem now is that

    My values for combo box are in the Budget.xlsm file and since the

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    is now invisible ...the combo box have no values in it.

    Could you please help me with this


    Regards, Hitesh

    Wednesday, February 4, 2015 9:34 PM
  • Hi Cimjet,

    I am now using the your code

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    for my excel file....But the problem now is that

    My values for combo box are in the Budget.xlsm file and since the

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    is now invisible ...the combo box have no values in it.... Also I have some List boxes in my userforms which are linked to some range in the excel file even they are blank

    Could you please help me with this


    Regards, Hitesh


    • Edited by ExcelUser2507 Wednesday, February 4, 2015 9:49 PM Edit
    Wednesday, February 4, 2015 9:47 PM
  • Hi Jim,

    I am now using the code given by Cimjet

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    for my excel file....But the problem now is that

    My values for combo box are in the Budget.xlsm file and since the

    Workbooks("Budget.xlsm").Windows(1).Visible = False

    is now invisible ...the combo box have no values in it.... Also I have some List boxes in my userforms which are linked to some range in the excel file even they are blank

    Could you please help me with this



    Regards, Hitesh

    Wednesday, February 4, 2015 9:49 PM
  • Hi ExcelUser2507,

    Since the origal issue was resoved, I closed this thread temporarily. And to get more effective response, I also suggest that you split different issues into mutiple threads.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 6, 2015 11:59 AM
    Moderator