Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screenupdating

Status
Not open for further replies.

merlynsdad

Programmer
Nov 18, 2010
175
US
I'm opening two additinoal workbooks but don't want either of them to show. The code has the following:

screenupdating = false
displayalerts = false
workbooks.open "WB#1"
activewindow.visible = false
workbooks.open "WB#2"
activewindow.visible = false
screenupdating = true

Nonetheless, as the workbooks open they briefly show for a few seconds. I would prefer they didn't show at all. How do I do that?


 
Hide the worksheets in question before you save them. (Just close Excel and it will prompt if you want to save the hidden workbooks).

Gavin
 
Where is there a save in "before you save them"?

You could try using objects?



workbooks.open "WB#1"

looks funny as a Workbook open instruction. Workbook.Open requires a filename.


unknown
 
Apologies if I was not clear.
The OP is opening workbooks (WB#1, WB#2) then immediately hiding the window (VBA speak = setting visible to False).
I was suggesting that the OP arranges things so that these files already have that property set. That will definitely solve his problem.

To further add that you could make it so those two workbooks (WB#1, WB#2) open visible when opened normally. You would do this by having a Workbook_Open event code that makes the window visible unless (say) a particular workbook is open.... and a Before_Save event to make sure it is always saved with the window hidden.

Gavin
 
here's one way that tries to work with your current code

Create a class (e.g. Class1):
Code:
[blue]Option Explicit

Public WithEvents App As Application

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
    ActiveWindow.Visible = False
End Sub[/blue][/class]

Then modify your code as follows:
   Dim HideOpen As Class1
    
    Set HideOpen = New Class1
    Set HideOpen.App = Application
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    Workbooks.Open "WB#1"
    Workbooks.Open "WB#2"
    
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    
    Set HideOpen = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top