|
-
Jun 27th, 2013, 06:49 AM
#1
Thread Starter
New Member
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
-
Jun 27th, 2013, 09:22 AM
#2
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
-
Jun 27th, 2013, 11:07 AM
#3
Thread Starter
New Member
Re: Hiding Workbook with other workbook open
 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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|