ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Open Second Workbook Hidden? (https://www.excelbanter.com/excel-worksheet-functions/243293-open-second-workbook-hidden.html)

Nancy Taylor[_2_]

Open Second Workbook Hidden?
 
I have a workbook that populates a drop down list from another master
workbook. I have been able to set up my workbook to open the master so that
the listboxes populate by using the workbooks.open function, but focus is on
the second workbook - which I don't want. Is there a way to open a second
workbook "hidden" or at least get the focus back on my first workbook?

Jacob Skaria

Open Second Workbook Hidden?
 
Try the below macro...This will open book2.xls....but the activeworkbook will
remain active....If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub Macro()
Dim wb As Workbook
Set wb = ActiveWorkbook
Application.ScreenUpdating = False
Workbooks.Open "c:\book2.xls"
Application.ScreenUpdating = True
wb.Activate
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Nancy Taylor" wrote:

I have a workbook that populates a drop down list from another master
workbook. I have been able to set up my workbook to open the master so that
the listboxes populate by using the workbooks.open function, but focus is on
the second workbook - which I don't want. Is there a way to open a second
workbook "hidden" or at least get the focus back on my first workbook?


Nancy Taylor[_2_]

Open Second Workbook Hidden?
 
Perfect! I figured there had to be a way to save the workbook name and then
give it focus again.

Thanks so much!

"Jacob Skaria" wrote:

Try the below macro...This will open book2.xls....but the activeworkbook will
remain active....If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub Macro()
Dim wb As Workbook
Set wb = ActiveWorkbook
Application.ScreenUpdating = False
Workbooks.Open "c:\book2.xls"
Application.ScreenUpdating = True
wb.Activate
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Nancy Taylor" wrote:

I have a workbook that populates a drop down list from another master
workbook. I have been able to set up my workbook to open the master so that
the listboxes populate by using the workbooks.open function, but focus is on
the second workbook - which I don't want. Is there a way to open a second
workbook "hidden" or at least get the focus back on my first workbook?



All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com