View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Daminc[_65_] Daminc[_65_] is offline
external usenet poster
 
Posts: 1
Default Moving a workbook


I've got a base solution if anyone is interested:

The code gets the workwook in the source folder and then moves it into
an archive folder with date of the move attached to the front.


Code:
--------------------
Public Sub Move_rename_workbook()

Dim bookpath As String
Dim wkbkname As String
Dim actiondate As String
Dim dateofchange As String
Dim newname As String
Dim OldFilePath As String
Dim NewFilePath As String

Const sourcepath = "P:\VBA training\Test_folder\"
Const archivepath = "P:\VBA training\archive\"

wkbkname = Dir(sourcepath & "*.xls")

bookpath = sourcepath & wkbkname

actiondate = Format(Now(), "ddmmyyyy")

newname = (actiondate) & "_" & wkbkname

OldFilePath = bookpath
NewFilePath = archivepath & newname

Name OldFilePath As NewFilePath

End Sub
--------------------


--
Daminc
------------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074
View this thread: http://www.excelforum.com/showthread...hreadid=534196