Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I need some help in finding the file name of the currently opened worksheet in excel. Is there an easy function such as Environ() that can be used to find the current opened file? Thanks, Ryan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ordinate()
MsgBox (ActiveSheet.Name) End Sub for the sheet name Sub ordinate() MsgBox (ActiveWorkbook.Name) End Sub for the workbook name -- Gary''s Student - gsnu200753 "rchan11" wrote: Hi, I need some help in finding the file name of the currently opened worksheet in excel. Is there an easy function such as Environ() that can be used to find the current opened file? Thanks, Ryan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much! I should have searched the forums...I believe the
answer has been posted before. "Gary''s Student" wrote: Sub ordinate() MsgBox (ActiveSheet.Name) End Sub for the sheet name Sub ordinate() MsgBox (ActiveWorkbook.Name) End Sub for the workbook name -- Gary''s Student - gsnu200753 "rchan11" wrote: Hi, I need some help in finding the file name of the currently opened worksheet in excel. Is there an easy function such as Environ() that can be used to find the current opened file? Thanks, Ryan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can reference either of two files directly: the object ActiveWorkbook is
a reference to the workbook that is active in the main Excel window. This may not be the same workbook that contains the executing code. The ThisWorkbook object refers to the workbook containing the executing code, which may not be the same workbook that is active in the main Excel window. From either of these you can use the Name or FullName properties to get the Name (file name without drive or directory info) or the complete file name (including drive and folder information). E.g., Debug.Print ActiveWorkbook.Name Debug.Print ThisWorkbook.FullName -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "rchan11" wrote in message ... Hi, I need some help in finding the file name of the currently opened worksheet in excel. Is there an easy function such as Environ() that can be used to find the current opened file? Thanks, Ryan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub location()
MsgBox ActiveSheet.Name 'sheet name MsgBox ActiveWorkbook.Name 'filename MsgBox ActiveWorkbook.Path 'path End Sub -- -John Please rate when your question is answered to help us and others know what is helpful. "rchan11" wrote: Hi, I need some help in finding the file name of the currently opened worksheet in excel. Is there an easy function such as Environ() that can be used to find the current opened file? Thanks, Ryan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run VBScript from Excel | Excel Discussion (Misc queries) | |||
vbscript and Excel | Excel Programming | |||
Excel & VBScript | Excel Programming | |||
Removing Add-ins programmatically from Excel 2003 using VBScript | Excel Programming | |||
Using excel through vbscript | Excel Programming |