Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() This macro has gone through a lot of changes as you can see with all the comment tags. I'm trying to find a workbook in a folder and then move it to another folder with an altered name. Code: -------------------- Public Sub name_of_workbook() Dim bookpath As Variant Dim sourcepath As Variant Dim Wrkbook As Workbook Dim archivepath As String Dim wkbkname As String Dim wkbkaddr As String Dim actiondate As Variant Dim dateofchange As String Dim newname As String sourcepath = "P:\VBA training\Test_folder" For Each Wrkbook In sourcepath bookpath = Wrkbook.FullName 'bookpath = ActiveWorkbook.FullName archivepath = "P:\VBA training\archive\" wkbkname = bookpath.Name 'wkbkaddr = ActiveWorkbook.Address actiondate = Format(Now(), "ddmmyyyy") 'FormatDateTime(actiondate, 2) 'dateofchange = (actiondate, "dd mm yy") newname = (actiondate) & "_" & wkbkname 'bookpath.Close bookpath.Move "archivepath & newname" Next Wrkbook 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving Data between sheets in the same workbook and moving data between Workbooks. | Excel Worksheet Functions | |||
Moving data from one workbook to another workbook | Setting up and Configuration of Excel | |||
Moving Within A Workbook | Excel Discussion (Misc queries) | |||
Moving Cell Information from one workbook into another workbook | Excel Worksheet Functions | |||
Moving one workbook page to a new workbook | Excel Worksheet Functions |