Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Filename prgramatically
I have a line of code:
strThisFileName = "MY Excel FileName.xls" How do I set my variable to the current excel filename? strThisFileName = Workbooks.?? Thanks Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Filename prgramatically
Use ThisWorkbook.Name
To get the path: ThisWorkbook.Path So your code would be: strThisFileName = Thisworkbook.Name Toby Erkson Oregon, USA On Fri, 16 Apr 2004 10:51:40 -0700, "Mike D" wrote: I have a line of code: strThisFileName = "MY Excel FileName.xls" How do I set my variable to the current excel filename? strThisFileName = Workbooks.?? Thanks Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Filename prgramatically
Hi
strThisFileName = Activeworkbook.name -- Regards Frank Kabel Frankfurt, Germany Mike D wrote: I have a line of code: strThisFileName = "MY Excel FileName.xls" How do I set my variable to the current excel filename? strThisFileName = Workbooks.?? Thanks Mike |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Filename prgramatically
NeverMind
ThisWorkbook.Name -----Original Message----- I have a line of code: strThisFileName = "MY Excel FileName.xls" How do I set my variable to the current excel filename? strThisFileName = Workbooks.?? Thanks Mike . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Filename prgramatically
Hey, Mike.
Your Workbooks.??? method will DO something to the workbook. You want to ask it something, I think. strThisFileName = ActiveWorkbook.Name strThisSheetName = ActiveSheet.Name ....assuming the reference is to an open workbook with an active sheet. Before I run these lines, I reassure myself with something like: Range("C3").Select Range("C3").Activate Then the cell (or range) you have activated will also activate that sheet and the book that contains it. You may also have interest in: ActiveWorkbook.SaveAs (strThisNewFileName) ActiveWorkbook.Close Anyway, I hope that's what you were looking for. Good luck, it sounds like fun. Matthew =} -----Original Message----- I have a line of code: strThisFileName = "MY Excel FileName.xls" How do I set my variable to the current excel filename? strThisFileName = Workbooks.?? Thanks Mike . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel adds a 1 to the end of the filename. | Excel Discussion (Misc queries) | |||
Cell("filename") doesn't update to new filename when do save as. | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
Excel puts a 1 at the end of my filename | Excel Discussion (Misc queries) | |||
Saving filename same as import filename | Excel Programming |