View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Varun Nair Varun Nair is offline
external usenet poster
 
Posts: 10
Default rename files in a folder

HI norman,

I tried using your code.
but it didn't do anything.

a reminder that i am using the VB on excel. is there any .ocx that i need to
include?
--
Varun Nair



"Norman Jones" wrote:

Hi Varun,

As an alternative, try:

'=============
Public Sub Tester001()
Dim FName As String
Dim MyPath As String
Dim OldName As String
Dim NewName As String

MyPath = "C:\B\Test\" '<<==== CHANGE
FName = Dir(MyPath & "*.Wav")
Do While FName < ""
OldName = FName
NewName = Left(OldName, 6) & ".Wav"

Name MyPath & OldName As MyPath & NewName

FName = Dir()
Loop
End Sub
'<<=============



---
Regards,
Norman



"Varun Nair" wrote in message
...
Hi,

I have a set of .wav files in a folder. Can some one help me with a macro
which could rename all the files in a folder.

the naming scheme should be as mentioned below

oldname : 123456_xyz
newname: 123456

i.e. the new name should only contain the first 6 first characters of the
ond name.

--
Varun Nair