Results 1 to 6 of 6
  1. #1
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,822
    Thanks
    134
    Thanked 481 Times in 458 Posts
    Hi All

    Some while ago, using VBA, I had my Excel file A open another Excel file B.
    But I didn't want Excel file B to be 'visible', i.e. I just wanted it 'available' to Excel file A.
    In other words, Excel file B was 'hidden' from view.
    I can't remember how I did it.

    Is it something as simple as
    windows("fileA.xls").visible = false ????
    or
    windows("fileA.xls").hidden= true ????

    or ??????

    zeddy

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Zeddy,

    Try:
    Code:
    Sub OpenAndHide()
    
       Workbooks.Open "G:\Excel\Test\Compare Data test.xls"
       ActiveWindow.Visible = False
       
    End Sub
    Of course you'll replace the file drive/path/name info.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,822
    Thanks
    134
    Thanked 481 Times in 458 Posts
    I wish I was drinking that beer? you have in your picture!

    So many thanks for your reply!
    It triggered the memory!

    so here is what I now use:
    '-------------------------------------
    'zFilename = actual name of wanted file e.g. "myfile.xlsb" etc
    'zFetch = full filename and path location to this wanted file e.g."\\ ..\xxxx\yyyy\zzzzzz\myfile.xlsb"

    Workbooks.Open Filename:=zFetch 'open datafile for IMPORT

    Windows(zFilename).Visible = False
    '-------------------------------------

    I remember one of the Excel gurus saying some while ago that you cannot always rely on the file that you have just opened as being the 'active' file.
    Something to do with if it was saved while in a windows 'minimised' state or something.
    So I always explicity use the Windows(zFilename) rather than Activewindow.

    Once again, many thanks for your quick response and helping me out.

    Regards

    zeddy





  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Zeddy,

    You're welcome. Actually, what's in that picture is the two parts of one of those retro-metal puzzles my brother-in-law sent me one year for Christmas. I took the picture 45 seconds after opening the present and emailed it to him. That was the real present!
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    You can also use:

    Code:
    Dim wbk as Workbook
    
    Set wbk = Workbooks.Open(Filename:=zFetch)
    
    wbk.Windows(1).Visible = False
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,822
    Thanks
    134
    Thanked 481 Times in 458 Posts
    Thanks Rory!

    Thumbs up for a very useful way of defining a shortcut to the hidden file.

    zeddy

Posting Permissions

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