+ Reply to Thread
Results 1 to 6 of 6

Hide, not close, one workbook

  1. #1
    Ed
    Guest

    Hide, not close, one workbook

    I have three workbooks open. I'd like to set an object to one of them so I
    can hide it away from the user, but still have it available for VBA to write
    to it. As far as I can tell, I have to use Application.Window, but I can't
    figure out how to set an object to one particular window to manipulate it.
    Hints and suggestions are greatly appreciated.

    Ed



  2. #2
    K Dales
    Guest

    RE: Hide, not close, one workbook

    Wiindows(WorkbookName).Visible = False
    WorkbookName should be the name as it appears in the title bar (normally the
    file name)


    "Ed" wrote:

    > I have three workbooks open. I'd like to set an object to one of them so I
    > can hide it away from the user, but still have it available for VBA to write
    > to it. As far as I can tell, I have to use Application.Window, but I can't
    > figure out how to set an object to one particular window to manipulate it.
    > Hints and suggestions are greatly appreciated.
    >
    > Ed
    >
    >
    >


  3. #3
    Bob Phillips
    Guest

    Re: Hide, not close, one workbook

    Hi Ed,

    Something like

    windows("Book2").Visible=False

    --
    HTH

    Bob Phillips

    "Ed" <ed_millis@NO_SPAM.yahoo.com> wrote in message
    news:[email protected]...
    > I have three workbooks open. I'd like to set an object to one of them so

    I
    > can hide it away from the user, but still have it available for VBA to

    write
    > to it. As far as I can tell, I have to use Application.Window, but I

    can't
    > figure out how to set an object to one particular window to manipulate it.
    > Hints and suggestions are greatly appreciated.
    >
    > Ed
    >
    >




  4. #4
    Tom Ogilvy
    Guest

    Re: Hide, not close, one workbook

    ' at the top of a module
    Public bk as workbook

    Sub HideBook()
    set bk = Workbooks("MyFile.xls")
    Windows(bk.name).Visible = False
    End Sub

    Sub UpdateBk()
    bk.worksheets("Sheet1").Range("A1").Value = 12
    End Sub

    Sub SeeDatafromBook()
    msgbox bk.Worksheets("Sheet1").Range("A1").Text
    End Sub

    --
    Regards,
    Tom Ogilvy

    "Ed" <ed_millis@NO_SPAM.yahoo.com> wrote in message
    news:[email protected]...
    > I have three workbooks open. I'd like to set an object to one of them so

    I
    > can hide it away from the user, but still have it available for VBA to

    write
    > to it. As far as I can tell, I have to use Application.Window, but I

    can't
    > figure out how to set an object to one particular window to manipulate it.
    > Hints and suggestions are greatly appreciated.
    >
    > Ed
    >
    >




  5. #5
    Ed
    Guest

    Thank you!

    Thanks to both of you.

    "Ed" <ed_millis@NO_SPAM.yahoo.com> wrote in message
    news:[email protected]...
    > I have three workbooks open. I'd like to set an object to one of them so

    I
    > can hide it away from the user, but still have it available for VBA to

    write
    > to it. As far as I can tell, I have to use Application.Window, but I

    can't
    > figure out how to set an object to one particular window to manipulate it.
    > Hints and suggestions are greatly appreciated.
    >
    > Ed
    >
    >




  6. #6
    Tushar Mehta
    Guest

    Re: Hide, not close, one workbook

    The suggestions from the others will work...for the most part. A more
    robust approach is the code fragment below. It is from an add-in I
    wrote recently for a fried:

    For i = 2 To MasterWB.Windows.Count
    MasterWB.Windows(i).Close
    Next i
    MasterWB.Windows(1).Visible = False

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Multi-disciplinary business expertise
    + Technology skills
    = Optimal solution to your business problem
    Recipient Microsoft MVP award 2000-2005

    In article <[email protected]>,
    ed_millis@NO_SPAM.yahoo.com says...
    > I have three workbooks open. I'd like to set an object to one of them so I
    > can hide it away from the user, but still have it available for VBA to write
    > to it. As far as I can tell, I have to use Application.Window, but I can't
    > figure out how to set an object to one particular window to manipulate it.
    > Hints and suggestions are greatly appreciated.
    >
    > Ed
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1