Opening a workbook without activating it

Pierre B

New Member
Joined
Feb 22, 2008
Messages
3
Hello all,

Can anyone tell me how I can open a workbook, but without making it the active workbook?

I'm writing this macro code, in which I need to open a log file and log certain events to it. When I open it in a regular fashion (Workbooks.Open), the file automatically becomes the active workbook, therefore displaying on the user's screen. Even if I quickly activate another workbook in the next statement, the user still sees the log workbook show up on the screen - be it briefly.



Here's the code I use:
Workbooks.Open Filename:=name of the log file<NAME file log of><NAME file log the of>
Workbooks(name of another workbook<NAME of workbook another><NAME of workbook another>).Activate
I use Excel 2007, but must save whatever I do in Excel 2003, for some users are still stuck with that version.

How can I open this log workbook without it showing up on the screen?

Thanks for looking into this.

Pierre
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Pierre B,

Try:

Code:
    Application.ScreenUpdating = False
    
    Workbooks.Open Filename:=name of the log file
    Workbooks(name of another workbook).Activate
    
    Application.ScreenUpdating = True


But, the opened log file will still show in the Windows Task Bar.


Have a great day,
Stan
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,819
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top