Workbook closing

  • I would like to know how to close a workbook without knowing what the name is. Users download files from the server and I don't know what the name is.


    I tried

    Code
    workbooks(fname).close

    but it doesn't work.


    The following is what is used to open the file.



    Thanks,


    Daniel

  • Re: Workbook closing


    Try Activeworkbook.close


    If you do not want to save any cahnges or have any intervening prompts then use


    Activeworkbook.close SaveChanges:=False

    Kieran

  • Re: Workbook closing


    Without a name - how do you identify it?


    You could use Workbooks(index), but means that you must know the index number of the workbook, not it's name. Is that the case?

    Kieran

  • Re: Workbook closing


    Keiran,


    Thanks for putting me on the right track. The last file opened can be closed by the following instruction.


    Workbooks(Workbooks.Count).Close



    Daniel

Participate now!

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