Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro and save files (Excel 2000)

    Hi everyone,

    I have created a macro in book1, -it open book2 (another file)
    and copies it contents - and pastes it into book1. I then go back and save and close
    book 2. This is all recorded in the macro. However when I run it the copy and paste works fine. But is always prompts me to save book2. I want it to save and close, without me having to click on the prompt.
    I would appreciate any of your wonderful ideas.

    Thanks kindly,

    Kerrie [img]/forums/images/smilies/smile.gif[/img]

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Macro and save files (Excel 2000)

    After the Paste, put this in your macro, using the appropriate workbook name:

    Workbooks("Book2").Save

    Look into the Save, SaveAs and SaveCopyAs Methods and teh Saved Property in VB Help for more information.
    -John ... I float in liquid gardens
    UTC -7DS

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro and save files (Excel 2000)

    Do it something like this:

    <pre> Application.DisplayAlerts = False
    Workbooks("Book2").Save
    Application.DisplayAlerts = True
    </pre>

    Legare Coleman

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Macro and save files (Excel 2000)

    In Word, you would put this line in:

    activedocument.saved = true

    to kid Word that the document hasn't changed (assuming it hasn't or that you don't want it to), then close it.

    Would 'workbooks("book2").saved = true' work, or is there a similar command?
    Beryl M


  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro and save files (Excel 2000)

    Unsurprisingly it's:

    ActiveWorkbook.Saved = True

    FWIW
    Gre

  6. #6
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro and save files (Excel 2000)

    Hi Legare Coleman,
    Excellent!!!! worked like a treat. Thank you, Thank you,

    Kerrie [img]/forums/images/smilies/smile.gif[/img]

Posting Permissions

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