View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] lance-news@augustmail.com is offline
external usenet poster
 
Posts: 22
Default backing up file in directory

This is renaming the file. I need to make a copy and still have
the original file:



OFILE = Application.GetOpenFilename("NREP Spectrum Files,*.fta", _
1, "Select One File To Open", , False)

'Backup Original Filename
newName = OFILE & ".org"
Name OFILE As newName


Workbooks.OpenText Filename:=OFILE, Origin:=437, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array_
(Array(0, 1), Array(10 _
, 1), Array(19, 1), Array(28, 1), Array(37, 1), _
Array(46, 1), Array(55, 1), Array(64, 1), _
Array(73, 1), Array(82, 1), Array(91, 1), Array(100, 1), _
Array(109, 1), Array(118, 1), Array(127, 1), _
Array(136, 1),Array(145, 1), Array(154, 1), Array(163, 1)), _
TrailingMinusNumbers:=True



Tom Ogilvy wrote:

newName = Left(OFILE,len(OFILE)-4) & ".org"
name oFile as newName

--
Regards,
Tom Ogilvy


wrote in message
...

The user is asked to select a file:


Dim SaveDriveDir As String
SaveDriveDir = CurDir
ChDrive "C"
ChDir "C:\NREP\REL"
OFILE = Application.GetOpenFilename("NREP Relative Power Files,*.rel",
1, "Select One File To Open", , False)



Now I want to copy the file with a new name because I am going to
overwrite the existing file OFILE

copy OFILE & ".org"

How do I do this?

Lance