I got it to work.  I was making it too complicated.  Thank you for the response.

 

Did not work:

If InStr(myfile, "Medication") Then

MyShortFile = Right(myfile, 8)

NewName = "MAR-" + MyShortFile

Name file.Name As NewName

End If

 

This did work:

If InStr(myfile, "Medication") Then

MyShortFile = Right(myfile, 8)

NewName = "MAR-" + MyShortFile

file.Name = NewName

End If

 

 

 

Paul Brungardt

Clinical Analyst

HaysMedicalCenter

PH: 785-623-2196

PG: 785-650-5989


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corinna
Sent: Thursday, May 19, 2005 12:13 PM
To: [email protected]
Subject: RE: [Talk] Renaming Files

 

Paul,

 

I just noticed it looks like you already tried my suggestion, are you closing the files first?

If so and it still does not work, another thing I do is close the file then i move it using

Filecopy sourceFile, DestinationFile

then I delete the original

Kill sourcefile

 

 

Thanks,

Corinna Robertson

 

Boston Software Systems

[EMAIL PROTECTED]

www.bostonworkstation.com

The Essential Tool for Healthcare Integration

866-653-5105 ext. 5

508-653-5105

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Brungardt
Sent: Thursday, May 19, 2005 12:57 PM
To: [email protected]
Subject: [Talk] Renaming Files

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