+ Reply to Thread
Results 1 to 5 of 5

Excel Opens and Closes by itself.

  1. #1
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Excel Opens and Closes by itself.

    Attached is a spreadsheet that I use to track my weight.

    If I open Excel and I navigate to it and launch it, Excel opens and then closes. If I do it a second time the sheet comes up along with the fact that it was improperly closed the last time. I can either accept the displayed copy or choose the "saved" copy. Either way works fine.

    If I navigate to the file in windows and double click on it, it opens just fine.

    To add one more piece to the confusion: this is Version 8 of the spreadsheet. It is a rebuilt from scratch version of Version 7. The only thing I did was copy in the data. Version 7 had the exact same issues.

    Another side issue is that the chart on the right on the weight sheet does not display until you click somewhere on the sheet.

    The rest of my spreadsheets work just fine. This issue started about a month ago. For 8 years prior, things worked just fine.

    FYI: the only code in the workbook is run on workbook open and it calls this macro to set the axis on the chart.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Excel Opens and Closes by itself.

    It works fine for me on a Mac. Does it make a difference if you amend the code to:

    Please Login or Register  to view this content.
    Last edited by rorya; 07-12-2019 at 07:42 AM. Reason: Add wb reference
    Rory

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Opens and Closes by itself.

    That appears to work. Now the question is, WHY? In theory it should be the same code.

    Thanks.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Excel Opens and Closes by itself.

    In my experience, it's rarely a good idea to select objects while the workbook is opening (generally best avoided anyway). In fact, if I use code in the Workbook_Open event, I tend to use OnTime to schedule it (even if I just use Now() as the time) so that the workbook is fully loaded before the code tries to do anything.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Opens and Closes by itself.

    It's back doing it again. I even put in a two-second delay before calling the subroutine. I'll just work around the issue by launching it from a shortcut instead of a pinned spreadsheet in Excel. That always works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VB code that Opens a powerpoint, savesAs and closes the ppt
    By ajm1991 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2015, 01:16 PM
  2. Speed up code that opens and pulls data from 30+ excel files and then closes file
    By chadwick140 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2013, 09:58 AM
  3. Trying to open Access using VBA, opens quick then closes any Ideas?
    By Harrm034 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2011, 03:47 PM
  4. File opens then closes automatically due to filename
    By p4c970 in forum Excel General
    Replies: 8
    Last Post: 03-09-2011, 08:25 AM
  5. VBA in Word opens, closes Excel app but process still running in Task Manager
    By 6StringJazzer in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 02-16-2011, 09:10 AM
  6. Macro that opens and closes many files uses too much memory
    By Whizbang in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2010, 04:31 PM
  7. excel opens file then closes automatically
    By jpruffle in forum Excel General
    Replies: 3
    Last Post: 09-21-2009, 04:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1