locked
Office 2013 ScreenUpdating Problem RRS feed

  • Question

  • The following code does not give me the desired result: Having the first file that was opened be visible on the screen when the macro ends.

    I saw a discussion about this issue here before and hope someone can tell me wha the problem is and how to fix it. It seems to be related to the Application.ScreenUpdating=False line of code. If I remark out that line, the code works.

    Option Explicit

    Dim strOne As String
    Dim strTwo As String
    Sub Open_Books()

    'Turn off warnings, etc.
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    strOne = Application.GetOpenFilename("Excel Files (*.xlsx),*.xlsx", 1, "Find book one.", , False)

    Workbooks.Open strOne

    strOne = ActiveWorkbook.Name

    strTwo = Application.GetOpenFilename("Excel Files (*.xlsx),*.xlsx", 1, "Find book two.", , False)

    Workbooks.Open strTwo

    strTwo = ActiveWorkbook.Name

    Windows(strOne).Activate

    'Turn on warnings, etc.
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True

    End Sub

    Monday, April 6, 2015 4:27 PM

All replies

  • One option would be to open the strTwo workbook first, then the strOne workbook.

    Another would be to move the line

    Windows(strOne).Activate

    to below Application.ScreenUpdating = True, i.e. just above End Sub.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, April 6, 2015 4:37 PM
  • Hi Hans,

    Thanks for the reply.

    Your first suggestion would work in this test case, but not in the long term for more complex macros.

    The second suggestion does not work - tried it early on.

    Can you replicate the problem with Office 2013?

    Monday, April 6, 2015 4:44 PM
  • Yes, I can reproduce the problem. It looks like the implementation of SDI (single document interface) in Excel 2013 is slightly buggy. Hopefully it'll be better in Excel 2016, which is due later this year.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, April 6, 2015 7:06 PM
  • Hello Ken,

    Can you please explain me about the issue you are facing with expected and actual results? Can you also provide me the version of Office you are using?

    Regards,

    Anush

    Wednesday, April 8, 2015 3:35 PM
  • Hi Anush,

    Please see my first post.

    When the routine ends I want the workbook "strOne" to be open on my desktop. It is not. Workbook "strTwo" is open.

    I am using Office 2013. I also have Office 2007 and Office 2010 on other machines and the routine behaves as expected using those versions.

    If I hard code in the paths and files to be opened instead of using GetFileOpenName, the routine runs correctly in 2013. If I eliminate the "ScreenUpdating = False" code the routine runs correctly.

    And if I put a break in the code, after the code breaks, the last workbook opened is on the screen instead of the VBA code.

    Wednesday, April 8, 2015 5:13 PM
  • Hello Ken,

    Apologies for the delayed reply.

    I was not able to reproduce the issue at my end. I would recommend you to update Office to the latest build and then try the VBA code to check if issue occurs.

    If you still find that the issue occurs, then I would suggest you to open a ticket under the paid support category which requires a more in-depth level of support.  If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Please let me know if you have any concerns.

    Regards,

    Anush

    Tuesday, May 12, 2015 2:05 PM
  • Hello Ken,

    May i ask you whether your problem is solved? The same problem occurred to me recently when useing office 2013.

    Many thanks,

    Jiaen

    Thursday, August 25, 2016 12:38 PM