2

I have 3 input boxes that when a document is selected it opens the document and fills in a select box. With Excel 2013 these windows are opened in front of the document and have to be minimized in order to select the next one. Is there a way to have it automatically open documents in the background?

Workbooks.Open (file_path)
If Application.Version >= 15# Then
    ActiveWindow.WindowState = xlMinimized
End If

This what I currently have, however I would rather it open in the background in the first place over having to minimize it. I have tried to turn off screen updating for the part, however that did not work.

Application.ScreenUpdating = False
    Workbooks.Open (file_path)
Application.ScreenUpdating = True

Does Application.ScreenUpdating affect WorkBooks.open in Excel 2013?

Community
  • 1
  • 1
Jblo1108
  • 21
  • 3
  • 1
    http://stackoverflow.com/questions/579797/open-excel-file-for-reading-with-vba-without-display – Siddharth Rout Jul 30 '15 at 19:52
  • The form I'm using is Excel, so there will be multiple Excel windows up at the same time once the user chooses the first document – Jblo1108 Jul 30 '15 at 19:59
  • There are lot f suggestions mentioned in that link. Did you go through all and didn't like even a single suggestion :)? – Siddharth Rout Jul 30 '15 at 20:00
  • Yes, thats where I went first, but the Issue is a excel 2013 issue and that was using 2007. My code works fine on 2007 but now that workbooks open in a new instance of excel as opposed to the same one they appear in front of the current users window. – Jblo1108 Jul 30 '15 at 20:02
  • Use `CreateObject` and open them in a separate instance (Hide that instance) – Siddharth Rout Jul 30 '15 at 20:04

1 Answers1

0

Application.ScreenUpdating will not work with excel 2013.

You may try creating function:

Sub myScreenUpdate(screenUpdateRequest As Boolean, previousScreenUpdate As Boolean)
    If screenUpdateRequest Then
        Application.ScreenUpdating = previousScreenUpdate
    Else
        previousScreenUpdate = Application.ScreenUpdating
        Application.ScreenUpdating = False
    End If
End Sub

call req:

  1. Call myScreenUpdate(False, previousScreenUpdate)
  2. Call myScreenUpdate(True, previousScreenUpdate)

    Dim previousScreenUpdate as boolean
    Call myScreenUpdate(False, previousScreenUpdate) 'to get the current setting into previousScreenUpdate
    Call myScreenUpdate(True, false)  'to set updating to false
    'do your heavy code here and when finished:
    Call myScreenUpdate(True, previousScreenUpdate)
    
krlzlx
  • 5,752
  • 14
  • 47
  • 55
Mike
  • 3
  • 6