Excel VBA Does Not Run When File Is Closed and Opened After First Time

  • Hi All,


    The code below creates a PDF file for each worksheet in the workbook. I have a VBA code that works on a new workbook, but once the file is closed and opened again, when running the code again, the code seems to run, but does not produce any files. Any help is appreciated:


  • Re: Excel VBA Does Not Run When File Is Closed and Opened After First Time


    What do you expect to happen with on error resume next that makes it appropriate to use that code.


    Are you running this against the same workbook with the same sheet names each time?

    Bruce :cool:

  • Re: Excel VBA Does Not Run When File Is Closed and Opened After First Time


    Hi Bruce,


    To be honest, I'm not sure what I'm doing and yes, I am running this in the same workbook with the same sheet names each time.

  • Re: Excel VBA Does Not Run When File Is Closed and Opened After First Time


    There's nothing in your code to create a unique name, so it's just creating PDF's with the same name each time.

    Bruce :cool:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!