+ Reply to Thread
Results 1 to 7 of 7

save entire excel file through VBA

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    save entire excel file through VBA

    Hello everyone. I need a small solution

    I have this code which saves the excel file.

    However it only saves changes of sheet 1 and sheet 2.

    I have 10 sheets.

    I need to save the changes made to all the sheets at once.

    The code which i have is

    Please Login or Register  to view this content.

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

    Re: save entire excel file through VBA

    Excel does not partially save a workbook with that line
    The macro did not run the last time you tried to run it.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: save entire excel file through VBA

    Hey Kev,

    Thank you .


    I have a code which copies cells value from sheet "Invoice" to sheet "Product", "Sales", "Invoice data"

    I tried running it but it only saves changes made to sheet "Product" and sheet "Sales".

    It does not save changes made to sheet "Invoice data"

    Could you please help me?

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: save entire excel file through VBA

    if you post the full code you are using, then you might get an answer. There is not much to go on, what Kev says if perfectly correct

  5. #5
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: save entire excel file through VBA

    Hey Davsth,
    Thanks for you reply.
    I have attached my sample workbook.

    In sheet "Invoice" if I press "Update Stock" then it automatically copies data to sheet " Sales" and "Invoice data" and further saves the excel file.

    The "update Button" is a command button and it contains series of macros.

    So right now the "update stock" copies the data . However it saves data only for sheet " Invoice" , " Product" and "Sales". It does not save the data which is copied in sheet " Invoice data"

    So when i close the excel file then it asks me whether I want to save the data.

    If I press "yes" then it saves the data which is copied to "invoice data."

    If i press "no" then it does not save the data which is copied to "invoice data"

    So basically it means that it isnt saving data of sheet "invoice data"
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: save entire excel file through VBA

    The reason is as Kev says

    Please Login or Register  to view this content.
    You run the code for save_workbook

    before the code for button2_click

    so do not save that work, swap them the other way round

  7. #7
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: save entire excel file through VBA

    Hey Davsth
    Hey Kev.


    I am really sorry for the trouble. And a big THANK YOU. I dint realize that error. Thank you so much.

+ 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. VBA macro code hel to save a copy all sheets or entire file in a folder
    By sctr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2017, 07:44 AM
  2. Replies: 1
    Last Post: 05-15-2013, 01:26 PM
  3. Converting excel 2003 file ext macro file-save code to reflect excel 2007 exts
    By pmanoloff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2013, 12:17 PM
  4. Replies: 1
    Last Post: 01-16-2013, 02:02 AM
  5. Save and close entire instance of excel
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-05-2011, 08:29 PM
  6. Replies: 8
    Last Post: 06-16-2011, 11:49 AM
  7. [SOLVED] 'document not saved' for 'save' or 'save as' an EXCEL file
    By Judy Chuang in forum Excel General
    Replies: 1
    Last Post: 07-11-2005, 06:05 PM

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