View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Damon Longworth Damon Longworth is offline
external usenet poster
 
Posts: 111
Default editing filename

Try using the left function:

left(Fnames(c),len(Fnames(c))-4)

--
Damon Longworth

Don't miss out on the 2005 Excel User Conference
Sept 16th and 17th
Stockyards Hotel - Ft. Worth, Texas
www.ExcelUserConference.com


wrote in message
oups.com...
Hi, I have a folder of .prn files which with vba I use,
Sub GetFileNames()
Dim Fname As String
Dim Ftype As String

Ftype = Dir("H:\Sharescope excel update\*.prn")
i = 0
Fname = Ftype
Do Until Fname = ""
i = i + 1
ReDim Preserve Fnames(1 To i)
Fnames(i) = Fname
Fname = Dir
Loop
End Sub
To get the list. When I open the file it opens as aaa.prn,
understandably. I then save this file as a xl workbook using,
ChDir "H:\Trimmed DaTa"
ActiveWorkbook.SaveAs Filename:="H:\Trimmed DaTa\" & Fnames(c) &
"xls ", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
This is not a problem in as much as I can do what I need with the file.
But it saves it as aaa.prnxls. Is there a way of trimming the .prn off
before saving.
Regards Robert