Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Running macro on all open files.

  1. #1
    New Member
    Join Date
    May 2002
    Location
    Chad Miles
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I will be opening several files at one time. The macro will run on the active workbook then that work book is closed by the macro. The next workbook becomes active and the same process takes place. I get an error when the last macro is ran on the last workbook when i try to get the macro to close excel. How can i run this macro on all active files then close the excel program?

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Milescm,

    I assume that your code resides in the last workbook that you process. I'm wondering if the problem is that you close this last workbook before closing Excel? Closing the last workbook will of course stop the code from running since the code's ThisWorkbook object is no longer in existence. You should save ThisWorkbook, then do an Application.Quit to close Excel without saving.

    I hope this helps.
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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