|
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 Clinical Analyst HaysMedicalCenter PH: 785-623-2196 PG: 785-650-5989 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Corinna 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 The Essential Tool for
Healthcare Integration 866-653-5105 ext. 5 508-653-5105 From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of 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 Clinical Analyst HaysMedicalCenter PH: 785-623-2196 PG: 785-650-5989 |
- [Talk] Renaming Files Paul Brungardt
- RE: [Talk] Renaming Files Corinna
- RE: [Talk] Renaming Files Corinna
- Paul Brungardt
