+ Reply to Thread
Results 1 to 5 of 5

returning workbook name

  1. #1
    Saladin
    Guest

    returning workbook name

    Hi

    How do I return the name of my current workbook in code? Just the name ...
    path not essential.

    Thanks
    Graeme



  2. #2
    OJ
    Guest

    Re: returning workbook name

    MsgBox ActiveWorkbook.Name


  3. #3
    augustus
    Guest

    RE: returning workbook name

    application.ActiveWorkbook.Name

    "Saladin" wrote:

    > Hi
    >
    > How do I return the name of my current workbook in code? Just the name ...
    > path not essential.
    >
    > Thanks
    > Graeme
    >
    >
    >


  4. #4
    Patrick Molloy
    Guest

    RE: returning workbook name

    msgbox ActiveWorkbook.Name
    this returns the name of the currently active workbook

    msgbox ThisWorkbook.Name
    this returns the name of the workbook that is running the code

    So if code is running in Book1 but book2 is active, then the first msgbox
    gives Book2 and the second gives Book1

    x=3
    msgbox Workbooks(x).Name



    DIM WB as Workbook
    FOR EACH WB in Workbooks
    Debug.Priint WB.Name
    NEXT



    "Saladin" wrote:

    > Hi
    >
    > How do I return the name of my current workbook in code? Just the name ...
    > path not essential.
    >
    > Thanks
    > Graeme
    >
    >
    >


  5. #5
    Saladin
    Guest

    Re: returning workbook name

    Gosh that was quick! Thanks all.
    "Patrick Molloy" <[email protected]> wrote in message
    news:[email protected]...
    > msgbox ActiveWorkbook.Name
    > this returns the name of the currently active workbook
    >
    > msgbox ThisWorkbook.Name
    > this returns the name of the workbook that is running the code
    >
    > So if code is running in Book1 but book2 is active, then the first msgbox
    > gives Book2 and the second gives Book1
    >
    > x=3
    > msgbox Workbooks(x).Name
    >
    >
    >
    > DIM WB as Workbook
    > FOR EACH WB in Workbooks
    > Debug.Priint WB.Name
    > NEXT
    >
    >
    >
    > "Saladin" wrote:
    >
    >> Hi
    >>
    >> How do I return the name of my current workbook in code? Just the name
    >> ...
    >> path not essential.
    >>
    >> Thanks
    >> Graeme
    >>
    >>
    >>




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1