![]() |
Move File to new folder - Problem
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 -- Les |
Move File to new folder - Problem
Sorry my mistake.... I did not save the file with a different name before
moving it... Problem solved now.... :0) -- Les "Les" wrote: 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 -- Les |
All times are GMT +1. The time now is 12:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com