Excel Filename [SOLVED]

  • Hi!


    Id like to know how I may get/know the filename of the current workbooks I am working on, through vba.


    Thanks in advance.

  • Do you mean produce a list of files you have open?


    If not can you be more specific?

    Robert Hind
    Perth - Western Australia

  • Hi r_hind!


    Sorry about that. No, I only want to know through vba the filename of the workbook I am working. and Yes, if it is possible to list all the filenames of the opened workbooks (though, it is not that important.)

  • Try these:


    Application.ActiveSheet.Range("b2").Value = ActiveWorkbook.FullName


    or


    Application.Worksheets("Sheet1").Range("A1").Value = ActiveWorkbook.FullName


    or


    MsgBox ("File Name = " & ActiveWorkbook.FullName)


    Regards


    AJW

  • Here is one way to get all open workbook names.


    Sub NameAllWorkbooks()
    x = 1
    For Each wb In Workbooks
    Cells(x, 1).Value = wb.Name
    x = x + 1
    Next
    End Sub

Participate now!

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