Re: Name a File via Code Q



If the extension is always 4 characters long (.xls), then you could just avoid
them

tempfilename = "part of " & right(sourcewb.name, len(sourcewb.name)-3) & ....

But if you're using xl2007 or weird extensions, then this wouldn't work.

You could use instrrev (xl2k and above) to look for the last dot and strip the
characters based on that position. But even that assumes that the filename has
an extension.


Seanie wrote:

I have a file that I create from a source document and name the file
basd on below. Which gives a new file name of "Part of name of
original file.xls 07-feb-09 1-30~.xls"

TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-
yy h-mm") & "~"

How could I exclude from the new file name the ext of the original
file? (the first.xls in my example above)

eg. what I want to appear is "Part of name of original file 07-feb-09
1-30~.xls

--

Dave Peterson
.



Relevant Pages

  • Re: Getting MSW to convert txt to doc in vba
    ... >then I assign textfilename as the filename. ... >up having a .txt extension. ... Is there a way to get the filename without the ... The LCase function converts the filename to all lowercase characters, ...
    (microsoft.public.word.vba.customization)
  • Re: Compressed html archive(chm and tgz)
    ... *against* my contention that the last few characters of a file name ... The OP wants to invent new "extensions" for compressed HTML pages such ... be .tar.gz or .tgz and would become .tgh, ... said serves to confirm or deny, that changing the "extension" of the ...
    (comp.os.linux.misc)
  • Re: What is the maximum number of characters you can use to name a fil
    ... PowerPoint 2002: The total length of both the path and the file name, including file name extension, cannot exceed 256 characters. ... This limitation includes three characters that represent the drive, the characters in the folder names, the backslash character between folders, and the characters in the file name. ...
    (microsoft.public.word.docmanagement)
  • Re: How do I convert a JPEG file back to text?
    ... > characters that your text editor is interpreting the binary data as. ... > switch, like a light switch. ... This is done via the file extension. ... So, you could give it a .jpg extension, and try ...
    (microsoft.public.frontpage.programming)
  • Re: Name a File via Code Q
    ... Dave Peterson wrote: ... If the extension is always 4 characters long, ... eg. what I want to appear is "Part of name of original file 07-feb-09 ...
    (microsoft.public.excel.programming)

Loading