Just got done doing something similar this morning, but I made them vbs so they 
could be used as needed rather than trying to schedule something automatically. 
 Unless I've already got BWS running I use VBScriptin to rename files.

Brian Bennett
Affinity Health Systems
Systems Analyst
PBS\Clinic Billing
(920)628-9055
[email protected]



________________________________
From: [email protected] [mailto:[email protected]]
Sent: Thursday, April 15, 2010 1:43 PM
To: [email protected]
Subject: RE: [talkbws] File Renaming Script

Here is what I use, but is this over-doing it?  It works, but can this code be 
streamlined?
The code is used in an Access DB and copies a file (with a new date in the file 
name each day) to a working folder that the database uses.
For example the file name today was 'FILE20100414.txt', but I just want to copy 
it to a temporary folder as 'FILE.txt'.
My current code is:

Private Sub cmdCopyNEWRPT_Click()
On Error GoTo Err_cmdCopyNEWRPT_Click
    Dim MyPath As String
    Dim MyDestination As String
    Dim MyFile As String
    Dim MyNewFile As String
    Dim MyName
    Dim MyNameWithPath
    Dim FileSys
    Dim RetVal
'
    Set FileSys = CreateObject("Scripting.FileSystemObject")
    MyPath = "T:\"
    MyName = Dir(MyPath & "NEWRPT.*.txt", vbDirectory)
    MyNameWithPath = MyPath & MyName
    MyDestination = "T:\BATCH\"
    MyNewFile = MyDestination & "NEWRPT.txt"
    If FileSys.FileExists(MyNameWithPath) Then
        FileSys.CopyFile MyNameWithPath, MyNewFile, True
        MyName = Dir
        MyNameWithPath = MyPath & MyName
        RetVal = MsgBox("File copy complete", vbOKOnly, "File copy complete")
    Else
        RetVal = MsgBox("File does not exist", vbCritical, "File does not 
exist")
    End If
Set FileSys = Nothing
Exit_cmdCopyNEWRPT_Click:
    Exit Sub
Err_cmdCopyNEWRPT_Click:
    MsgBox Err.Description
    Resume Exit_cmdCopyNEWRPT_Click
End Sub

Thanks,
Chase Rodgers
Director of Financial Reporting
Medical City and Medical City Children's Hospital
*972-566-3297
*[email protected]<mailto:[email protected]>


From: [email protected] [mailto:[email protected]]
Sent: Thursday, April 15, 2010 1:14 PM
To: [email protected]
Subject: RE: [talkbws] File Renaming Script

Use VBA

Name "C:\A.txt" As "C:\B.txt"

or if you just want to copy the file with a new location/name

FileCopy "C:\A.txt" , "C:\B.txt"



Chad Kemp
Information Systems Analyst
Firelands Regional Medical Center
419-557-7874


________________________________
From: [email protected] [mailto:[email protected]]
Sent: Thursday, April 15, 2010 1:24 PM
To: [email protected]
Subject: [talkbws] File Renaming Script
Does anybody use BWS script(s) for file renaming?

Mary Harvey
Information Systems - Applications Analyst
University Medical Associates
Email:  [email protected]<mailto:[email protected]>

The contents of this email are the property of University Medical Associates 
and may be confidential or legally privileged. If you received this message in 
error or are not the intended recipient, you should destroy the email message 
and any attachments or copies, and you are prohibited from retaining, 
distributing, disclosing or using any information contained herein. Please 
inform us of the erroneous delivery by return email.



---  To post a message to this list, send mail to: [email protected]    You are 
currently subscribed as: [email protected]    Unsubscribe in the customer 
center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx


---  To post a message to this list, send mail to: [email protected]    You are 
currently subscribed as: [email protected]    Unsubscribe in the 
customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx


---  To post a message to this list, send mail to: [email protected]    You are 
currently subscribed as: [email protected]    Unsubscribe in the 
customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx

________________________________
CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may 
contain confidential and privileged information for the use of the designated 
recipient(s) named above. If you are not the intended recipient, you are hereby 
notified that you have received this communication in error and that any 
review, disclosure, dissemination, distribution or copying of it or its 
contents is prohibited. If you have received this communication in error, 
please notify the sender at the electronic mail address noted above and destroy 
all copies of this communication and any attachments. Thank you for your 
cooperation.

---  To post a message to this list, send mail to: [email protected]    You are 
currently subscribed as: [email protected]    Unsubscribe in the 
customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx   

Reply via email to