Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Opening a workbook without being shown

  Asked By: Mali    Date: Sep 07    Category: MS Office    Views: 892
  

I want to know what VBA code can I use when I work in a workbook and I
want to open a second workbook to take data, but I don't want the
second one to display on the screen at all, not even at opening.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Ray Lawrence     Answered On: Sep 07

I'm no Excel expert but had the same problem as you. I solved it by
declaring the workbook  as an object. For example:

Set Wb1 = GetObject("DriveLetter:\FullPath\workbookname.xls") is the
workbook I use to read data  from for use in WB2, which I keep visible.
WB2 is also set as an object, but it is the one I open  and work  with.
I don't know if it's necessary to set it as an object but doing so
lets me address it as "Wb2" throughout the routine.

What happens is that Wb1 opens as a Hidden workbook as soon as I start
the routines from Wb2. It's never visible unless I "Unhide" it, but is
available for reading.

 
Didn't find what you were looking for? Find more on Opening a workbook without being shown Or get search suggestion and latest updates.




Tagged: