Results 1 to 8 of 8

vba - opening workbooks without showing

This is a discussion on vba - opening workbooks without showing within the Excel Questions forums, part of the Question Forums category; I have some code during which I open a workbook. however I do not want to show the workbook. i ...

  1. #1
    Board Regular
    Join Date
    May 2007
    Posts
    133

    Default vba - opening workbooks without showing

    I have some code during which I open a workbook. however I do not want to show the workbook. i have tried getting both screenupdating and displayalerts to false but no success. can anyone help?

  2. #2
    Board Regular JazzSP8's Avatar
    Join Date
    Sep 2005
    Location
    Chorley
    Posts
    925

    Default Re: vba - opening workbooks without showing

    Hi Andy

    I've got a few workbooks that open other workbooks, with Screenupdating switched off the only clue I have is when it appears on the Windows taskbar.

    Is this what you want to try and avoid?

    You can hide the taskbar using; 'Start > Settings > Taskbar and Start Menu Properties'

    You should have the option to autohide the taskbar which means that it dissapears when the mouse pointer isn't in that area.
    The harder you try, the dumber you look.


    - Posting guidelines, forum rules and terms of use

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes

  3. #3
    MrExcel MVP
    Moderator
    Andrew Poulsom's Avatar
    Join Date
    Jul 2002
    Posts
    64,601

    Default Re: vba - opening workbooks without showing

    This worked for me:

    Code:
    Sub Test()
        Workbooks.Open Filename:="C:\Temp\BOOK1.xls"
        ActiveWindow.Visible = False
    End Sub

  4. #4
    Board Regular
    Join Date
    May 2007
    Posts
    133

    Default Re: vba - opening workbooks without showing

    Thank you for your suggestions.
    I have the following code that is activated in by a button in a workbook.
    However the new spreadsheet "calendar" is still shown between is being opened and closed.
    Can anyone help further?

    strFilePath = "c:\"
    Public Const WbCal = "Calendar.xls"
    wbCalendar = strFilePath & "Calendar.xls"
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    Workbooks.Open wbCalendar
    ActiveWindow.Visible
    Workbooks(WbCal).Close

  5. #5
    Board Regular jim may's Avatar
    Join Date
    Jul 2004
    Location
    Roanoke, VA
    Posts
    6,160

    Default Re: vba - opening workbooks without showing

    Following the Workbook Open line
    enter:
    ActiveWindow.Visible = False

  6. #6
    MrExcel MVP
    Moderator
    Rediscovering the love
    Richard Schollar's Avatar
    Join Date
    Apr 2005
    Location
    UK
    Posts
    23,661

    Default Re: vba - opening workbooks without showing

    Another option would be to save the Calendar.xls down in a hidden state (ie much like the Personal.xls default setting) so that it opens up hidden too. Then you wouldn't need any additional code (altho the workbook will naturally open up hidden if opened directly from the File>Open menu).
    Richard Schollar

    Using xl2013

  7. #7
    Board Regular
    Join Date
    May 2007
    Posts
    133

    Default Re: vba - opening workbooks without showing

    how would i do that?
    the previous code works, but the file is still shown temporarily.

  8. #8
    MrExcel MVP
    Moderator
    Rediscovering the love
    Richard Schollar's Avatar
    Join Date
    Apr 2005
    Location
    UK
    Posts
    23,661

    Default Re: vba - opening workbooks without showing

    With Calendar.xls open within Excel, go Window>Hide and hide it. Then shut down Excel and when prompted whether you want to save changes to Calendar.xls click Save. If you open it up now, it will open up hidden (so you won't see it). Note that this can be very confusing especially to users who aren't aware of hidden workbooks.
    Richard Schollar

    Using xl2013

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com