+ Reply to Thread
Results 1 to 5 of 5

Return to worksheet from backstage view, i.e. close backstage view or exit backstage view

  1. #1
    Registered User
    Join Date
    11-18-2013
    Location
    planet earth
    MS-Off Ver
    Excel 2013
    Posts
    3

    Return to worksheet from backstage view, i.e. close backstage view or exit backstage view

    Hello Everyone,

    this is my first post ever because I could not find any answers while searching the forum (which usually helps me).

    I have written two macros that run smoothly when triggered via buttons. The first one saves the macro-enable workbook under a name the user enters while the file type is fixed to .xlsm. The second one "saves" a range of cells to PDF with a name also entered by the user. There are a bunch of conditions and I cover all possible scerarios i.e. cancel, overwrite existing files as well as initial file names.

    Now, I added a beforeSave event in case the user ignores my buttons. This event gets triggered when the user clicks 'FILE' followed by 'Save As ..'. Once 'FILE' is clicked the so called backstage view is shown. In the event I ask the user if s/he wants to save as .xlsm or as PDF (or cancel). Again both procedures work as intended, but after PDF or cancel is clicked, the backstage view is still shown. I cannot find a way to "close" the backstage view and make the worksheet visible again. I have tried to SendKeys Escape with Wait (Escape closes the Backstage View), but it gets ignored. I am pretty much a noob when it comes to VBA, so I even tried recording the actions "Click File and click the return arrow in the upper left", which does not get recorded as this does nothing to the file (I guess).

    Is there a one line code to close backstage view? Can I call that arrow in the upper left corner of the backstage view and "click" it via VBA?

    FYI: Usually, when you click 'File' > 'Save As' and then "Cancel' the Save As dialogue, the backstage view also does not close - only, if you click 'Save' in the dialogue.
    Also, once the event is finished running, the Workbook seems "unactivated", i.e. one has to kind of click twice, first to "go back to the workbook" (as in changing the program currently used) and then once more to click the arrow. Maybe the SendKeys would work if the workbook is "reactivated"?

    Thanks a lot for your time,
    Freddy
    Last edited by freddyroosevelt; 12-13-2017 at 06:16 AM. Reason: added some more details

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Return to worksheet from backstage view, i.e. close backstage view or exit backstage v

    Hi,

    I can only think of two options and both involve using XML in the CustomUI part of the workbook. The first option is simply to set up an onLo ad callback so that you can get access to the Ribbon object, which will allow you to call its ActivateTabMso method to activate a specific tab at the end of your code, which may solve your problem. The second, more detailed option, would be to actually customise the Backstage view to add your own save buttons. You can then simply set their isDefinitive attribute to have Backstage view automatically close after they are clicked.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    11-18-2013
    Location
    planet earth
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Return to worksheet from backstage view, i.e. close backstage view or exit backstage v

    Hi Don,

    thank you so much for your reply.

    However, I don't really understand or am too little of a VBA programmer to follow your instructions and it sounds quite complicated. (I did come accross the ActivateTabMso, but that didn't really work as I did not "set up an onLo ad callback"). I will do some research on this later and implement this or your alternative solution with the next update of the workbook.

    I will post once I figured it out (or not).

    Should I set this to 'Solved' already?

    Freddy

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Return to worksheet from backstage view, i.e. close backstage view or exit backstage v

    No, I would wait until you actually have a working solution. If you haven't already found it, it will be extremely worthwhile looking through these pages- http://www.rondebruin.nl/win/section2.htm
    If you don't like the CustomUI editor linked to on those pages, or have issues with installing programs, you may want to have a look at Andy Pope's add-in here- http://www.andypope.info/vba/ribboneditor_2010.htm

  5. #5
    Registered User
    Join Date
    11-18-2013
    Location
    planet earth
    MS-Off Ver
    Excel 2013
    Posts
    3

    Red face Re: Return to worksheet from backstage view, i.e. close backstage view or exit backstage v

    Hi Don, once again thanks for your input. I have not had the time to check out the links you sent and most likely will not get around it for some time. The "bug" is still there and I have "worked around it" by adding a message box with the FYI to click the back arrow in the upper left corner, which that pops up only in the respective scenarios.
    As advised I won't set the thread to solved.
    Last edited by freddyroosevelt; 01-18-2018 at 12:45 AM. Reason: forgot a word

+ 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. [SOLVED] How to return to normal view from custom view
    By Curious Dude in forum Excel General
    Replies: 9
    Last Post: 06-02-2021, 08:28 AM
  2. [SOLVED] Need to re-create Backstage File Propeties View
    By KiwiRickToo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-01-2016, 04:11 AM
  3. [SOLVED] Get Backstage and Ribbon customization to work together
    By KiwiRickToo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2016, 09:03 PM
  4. Excel, Word, PP 2013 Backstage View not disabling
    By mcm1009 in forum Excel General
    Replies: 0
    Last Post: 12-10-2014, 04:35 PM
  5. Default Settings in Backstage Print to "Print Selection
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-10-2014, 06:12 PM
  6. Replies: 1
    Last Post: 06-22-2012, 11:53 AM
  7. [SOLVED] How to view a custom view when the worksheet is protected?
    By JulesJam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-06-2006, 10:20 AM

Tags for this Thread

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