Move File to new folder - Problem

L

Les

Good day all, i am using the method below to move a file on the network but
it is not working, as i am not a programmer maybe i am missing something ??
Could anybody help please ??

Sub ChDirNet(szPath As String)
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting
path-Drive not mapped."
End Sub

Sub MoveOrigFileToArchive()
'
Dim OldName As String, newname As String, Todaysdate As String
Dim Cancel As Variant

Todaysdate = Format(Date, "dd.mm.yy")
'-------- Set the path
---------------------------------------------------------------------------
' ChDirNet "\\zapad01\sapinter\LCS\" '---- must change here for SAP path
-------
On Error Resume Next
OldName = "\\zapad01\sapinter\LCS\" & myLCS & ".xls"
newname = "\\zapad01\sapinter\LCS\Archive\" & Todaysdate & "_" & myLCS &
".xls"
Name OldName As newname
ChDir mySavedPath
MoveLCSFileToArchive
End Sub
 
L

Les

Sorry my mistake.... I did not save the file with a different name before
moving it... Problem solved now.... :0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top