I have an excel VBA script that I am using to consolidate a bunch of reports (roughly 100) into a single worksheet, for each worksheet that I am adding I would like the file name to appear in a column, however I need to remove the extension ".xlsx" which I can do no problem however when I remove the extension the formatting of the cell changes, for example a file might be named 001.xlsx I remove the .xlsx and excel drops the leading 00's. How do I go about remove the filename extension but preserve the cell formatting?
Here is the code that I am using to add the filenames:
rngFile.Value = wbkSrc.Name
rngFile.Replace What:=".xlsx", Replacement:="", LookAt:=xlPart
Any help is greatly appreciated, thank you.