+ Reply to Thread
Results 1 to 17 of 17

VBA to saveall & close all

  1. #1
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    VBA to saveall & close all

    Hi Friends,
    i need a VBA to save all (word,excel,powerpoint,notepad) & close all at once,
    Requesting VBA legends to help me on this, as it is urgent.

    Thanks in Advance.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to saveall & close all

    Welcome to the forum
    Why is it urgent?
    You already have a workaround....
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to saveall & close all

    Try this for Powerpoint, Word & Excel
    - you may need to modify the code if you usually have multiple instances of applications open

    VBA goes in Excel:
    Please Login or Register  to view this content.
    REfs.jpg
    Last edited by kev_; 12-13-2017 at 04:35 AM.

  4. #4
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    Hi Kev,
    Its working perfectly, thank you so much for your help !!!

    But the problem is here in some of the systems, we don't have access to TOOLS-REFERENCES(it was grayed out), so is there any alternative codes to make it work on remaining systems also?


    Thanks Again for your help

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to saveall & close all

    References may be greyed out because running the macro without the references would cause a VBA error which (in turn) results in option being greyed out.(references option is always greyed out in error debug mode).
    If so, the option should become available after resetting.

    Are you pasting the code into different files? Try sharing a common file which already has the relevant references.

  6. #6
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    hi kev,
    In some of the computers we dont have the access for TOOL---REFERENCES options ....actually it is hidden, its not in debug mode.
    anyway thank you so much for your reply & help
    Last edited by amb2301; 12-17-2017 at 05:56 AM.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to saveall & close all

    One way to solve this problem is to use a separate file containing application-specific VBA only.
    Word and Powerpoint files should already contain the references needed for their own VBA

    The code needs modifying slightly:

    Please Login or Register  to view this content.
    Last edited by kev_; 12-17-2017 at 08:15 AM.

  8. #8
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    Hi Kev,
    Thank you so much for your reply,
    so can i save the programs separately for word,powerpoint & excel, then call each program one by one ,
    so that will it happen?

    Thanks.

  9. #9
    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: VBA to saveall & close all

    If you make two small changes to the declaration, the references are unnecessary- the code is mostly late bound anyway
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  10. #10
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    Quote Originally Posted by xlnitwit View Post
    If you make two small changes to the declaration, the references are unnecessary- the code is mostly late bound anyway
    Please Login or Register  to view this content.

    Hi xlnitwit,
    Its an awesome work done by you....Thank you so much for your Help!!!

    Can you please help me in adding following things with that ..
    1. if some read only files available (excel,word,powerpoint ) has to be cancelled without saving.
    2. if we are working on a new file,then its getting stopped with prompt SAVE AS, it there any ways to save that file in desktop & get closed while running this macro?

    Awaiting for your Reply.

    Thanks

  11. #11
    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: VBA to saveall & close all

    What do you mean by "cancelled" in point 1? Cancel the whole process, or just not save the file, or something else?

  12. #12
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    sorry for my poor english.......i mean to say just cancel it(not to save read only files)
    rest all other macros to work as it is.

  13. #13
    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: VBA to saveall & close all

    Untested but perhaps this will do the job
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    Quote Originally Posted by xlnitwit View Post
    Untested but perhaps this will do the job
    Please Login or Register  to view this content.

    Hi xlnitwit,
    Excellent work.......its working perfectly........Thanks a Ton for your Help

  15. #15
    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: VBA to saveall & close all

    You're welcome- though kev_ did most of the work here; I merely tweaked a couple of parts!

  16. #16
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    Thank you so much Kev_ & xlnitwit .........Both of you made my work so easier..........My Hearty Appreciations to both of you !!!!

  17. #17
    Forum Contributor
    Join Date
    12-12-2017
    Location
    india
    MS-Off Ver
    2013
    Posts
    196

    Re: VBA to saveall & close all

    Hi Both,
    In simillar way i have one more incomplete task with me, i am in need of your helps.....i was already posted in the name "Auto fill Already opened webpage credentials"
    Requesting you to please extent your help on that thread.

    Thank you so much successful completion of this thread!!!!

+ 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] Issue with Open, copy, close Macro - when trying to close workbook Clipboard error
    By seanpcorbett1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2016, 05:14 PM
  2. [SOLVED] Userform Close (x) Check condition before close
    By rr1050 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-07-2016, 06:55 AM
  3. [SOLVED] Auto Close Msg Box after Time Period & Close Workbook
    By GJF36 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2015, 10:25 AM
  4. how to close userform using commndbutton and set automatic close at certain time
    By fatinmunie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2014, 12:51 PM
  5. [SOLVED] VBA Prompt to close PDF so file can be overwrtitten or close automatically
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2014, 12:31 PM
  6. Disable close workbook but still force users to close thru command button
    By rathig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 07:29 AM
  7. [SOLVED] Excel shoud not close all active books when clicking close button
    By technomike in forum Excel General
    Replies: 0
    Last Post: 06-10-2005, 01:05 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