Hi
How do I return the name of my current workbook in code? Just the name ...
path not essential.
Thanks
Graeme
Hi
How do I return the name of my current workbook in code? Just the name ...
path not essential.
Thanks
Graeme
MsgBox ActiveWorkbook.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
>
>
>
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
>
>
>
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
>>
>>
>>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks