Can anyone help me with renaming files in BW?  I am trying to rename files called “Medication Administration Record####.prn” to “MAR-####.prn”

I’m getting stuck on the renaming.

 

I have tried:

Name oldname As newname

Rename (oldname, newname)

 

___________________________________________________

Sub loopRename(Directory As String)

 

Dim myDestinationPath, newFileName, myfile As String

Set fso = CreateObject("Scripting.FileSystemObject")

Set mainfolder = fso.GetFolder(Directory)

Set filecollection = mainfolder.Files

For Each file In filecollection

myfile = file.Name

 

If InStr(myfile, "Medication") Then

MyShortFile = Right(myfile, 8)

NewName = "MAR-" + MyShortFile

 

'Name file.Name As NewName

 

End If

 

Next

End Sub

___________________________________________________

 

Thanks!

Paul

 

Paul Brungardt

Clinical Analyst

HaysMedicalCenter

PH: 785-623-2196

PG: 785-650-5989

 

Reply via email to