Continue macro

  • Hi


    I have a macro that prints alot of other documents. All the documents is listed in Excel. The macro looks into some cells and print the document that is written in those cells. My problem is that the last document that the macro prints maybe isn't there. Meaning that the document maybe isn't made yet. How can I get the macro to see if the document is there? And if it's there then print the document. And if it's not there then a mesage box should come telling that the document can't been printed and then end the macro?


    Alring

  • Re: Continue macro


    Can you post your code to see the structure and also to put the code into it? Makes it easier to provide an answer.


    Wigi

    Regards,


    Wigi


    Excel MVP 2011-2014


    For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes


    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

  • Re: Continue macro


    Hi Wigi


    This is a short code. the right one is very long because I open about 20 Word documents. But it's the last part where I want to open bNameAndPath that where I want to macro to see if the file (Range A10) is there and then print it. If it's not there then come with a message box saying it's not there and then end the macro.



    Alring

  • Re: Continue macro


    Hi


    I have changed the last part of the code. It's the part after:


    Code
    Application.CutCopyMode = False


    I have changed it to:


    The path for the file is in A9 and the filename comes from D1 and D2. and it's working as it should.
    But I still need to put in a message box that will come if the file don't exist. I have tried to put the code for the message box in after "Exit For" but then I have to press OK 18 times before the message box disapear again.
    So if some one knows where I can write the code for the message box then I will be gratefull.
    Alring

  • Re: Continue macro


    Hi there


    I got it not. I have changed the code total after trying alot of different things. So now it's working. The code look like this now.


    Regards
    Alring

Participate now!

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