editing filename

R

RobcPettit

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
 
D

Damon Longworth

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top