vba - opening workbooks without showing

andyjames

Board Regular
Joined
May 15, 2007
Messages
133
I have some code during which I open a workbook. however I do not want to show the workbook. i have tried getting both screenupdating and displayalerts to false but no success. can anyone help?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi Andy

I've got a few workbooks that open other workbooks, with Screenupdating switched off the only clue I have is when it appears on the Windows taskbar.

Is this what you want to try and avoid?

You can hide the taskbar using; 'Start > Settings > Taskbar and Start Menu Properties'

You should have the option to autohide the taskbar which means that it dissapears when the mouse pointer isn't in that area.
 
Upvote 0
Thank you for your suggestions.
I have the following code that is activated in by a button in a workbook.
However the new spreadsheet "calendar" is still shown between is being opened and closed.
Can anyone help further?

strFilePath = "c:\"
Public Const WbCal = "Calendar.xls"
wbCalendar = strFilePath & "Calendar.xls"
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Workbooks.Open wbCalendar
ActiveWindow.Visible
Workbooks(WbCal).Close
 
Upvote 0
Another option would be to save the Calendar.xls down in a hidden state (ie much like the Personal.xls default setting) so that it opens up hidden too. Then you wouldn't need any additional code (altho the workbook will naturally open up hidden if opened directly from the File>Open menu).
 
Upvote 0
With Calendar.xls open within Excel, go Window>Hide and hide it. Then shut down Excel and when prompted whether you want to save changes to Calendar.xls click Save. If you open it up now, it will open up hidden (so you won't see it). Note that this can be very confusing especially to users who aren't aware of hidden workbooks.
 
Upvote 0
This worked for me:

Code:
Sub Test()
    Workbooks.Open Filename:="C:\Temp\BOOK1.xls"
    ActiveWindow.Visible = False
End Sub


This code works great for opening the source workbook, but how do I set it back to normal and close it at the end of the code? I tried Workbooks.Close, but got an error.

Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

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