Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone,
I've nabbed this bit of code off the web and I'm using it with Chip Pearson's code that loops through files in a folder to change the tab name into the file name. All workbooks have only one sheet and code is working fine except that it is cutting the filename too short. I don't understand how the Left and -1 are working but think that the intention is to remove the path and file extension. If that's what the left and -1 are doing then why does the filename get shortened? Could any kind person please explain how this is working and show me how to amend to give the unshortened filename without path and extension? Thanks Diddy Sub renametabaswkbkname(myWB As Workbook) On Error Resume Next ActiveSheet.Name = Left(ActiveWorkbook.Name, Application.Find(".", ThisWorkbook.Name) - 1) myWB.Close savechanges:=True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SaveAs Filename:=filename, FileFormat:=xlCSV | Excel Programming | |||
Converting a Variable Filename to a Constant Filename | Excel Programming | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
set excel <filename to <filename-date | Excel Programming | |||
Saving filename same as import filename | Excel Programming |