Hiding Workbook with other workbook open
Hi All,
What I basically have is 2 workbooks the first one opens when the user selects to open it and the second one opens when the first workbook is open (In workbook open).
I would like to hide up the 2nd workbook - but the first workbook is constantly referencing the second workbook for information.
Does anyone know how would be best to do this?
Thanks in Advance
Re: Hiding Workbook with other workbook open
create a workbook object, then hide it. you can still "get at it" when hidden, like so:
Code:
Dim wb2 As Workbook
Private Sub Workbook_Open() 'opening "workbook1"
Dim myDir As String
Dim myFile As String
myDir = ActiveWorkbook.Path
myFile = myDir & "\wb2.xlsx"
Set wb2 = Workbooks.Open(myFile)
wb2.Windows(1).Visible = False
MsgBox wb2.Worksheets(1).Range("a1").Value 'to show you can access the hidden workbook object
End Sub
Re: Hiding Workbook with other workbook open
Quote:
Originally Posted by
vbfbryce
create a workbook object, then hide it. you can still "get at it" when hidden, like so:
Code:
Dim wb2 As Workbook
Private Sub Workbook_Open() 'opening "workbook1"
Dim myDir As String
Dim myFile As String
myDir = ActiveWorkbook.Path
myFile = myDir & "\wb2.xlsx"
Set wb2 = Workbooks.Open(myFile)
wb2.Windows(1).Visible = False
MsgBox wb2.Worksheets(1).Range("a1").Value 'to show you can access the hidden workbook object
End Sub
Thanks it worked great!