Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the code (below) to move files from one folder to another. After they
are moved (or before or during - does not matter) , I'd like to unprotect all the worksheets/workbooks that were moved and then unhide certain rows. I've seen samples of unprotecting, but they all seem to refer to the current worksheet (where the macros are being run) as opposed to the destination worksheets/workbooks. AND I can't figure out where to place them in the code below. ALSO: Is it possible to save the moved files with the name that appears in a certain cell in the worksheet(2) - (C108 name = WR06202008_MEB, for example) ? Can anyone help (the code below is Ron de Bruin's) with adding code that unprotects both the workbook and the worksheets, unhides certain rows and then saves the worksheet with the name of a cell in the worksheet(2)? Thanks very much. Theo Sub Move_New_WR() 'This example move the folder from FromPath to ToPath. Dim FSO As Object Dim FromPath As String Dim ToPath As String FromPath = "H:\WR Intake\Test Move" '<< Change ToPath = "H:\WR Intake New\" '<< Change 'Note: It is not possible to use a folder that exist in ToPath If Right(FromPath, 1) = "\" Then FromPath = Left(FromPath, Len(FromPath) - 1) End If If Right(ToPath, 1) = "\" Then ToPath = Left(ToPath, Len(ToPath) - 1) End If Set FSO = CreateObject("scripting.filesystemobject") If FSO.FolderExists(FromPath) = False Then MsgBox FromPath & " doesn't exist" Exit Sub End If If FSO.FolderExists(ToPath) = True Then MsgBox ToPath & " exist, not possible to move to a existing folder" Exit Sub End If FSO.MoveFolder Source:=FromPath, Destination:=ToPath MsgBox "The folder is moved from " & FromPath & " to " & ToPath End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Unhide, Unprotect, Enter Password | Excel Worksheet Functions | |||
Why does Excel unprotect all my sheets when I hit save? | Excel Discussion (Misc queries) | |||
Creating Macro to Unprotect and unhide | Excel Discussion (Misc queries) | |||
HOW CAN I HAVE THE SHEET TO BE PROTECTED, FORMULAS HIDDEN AND YET GIVE AN OPTION IN VB TO HAVE A TOGGLE TO PROTECT/ UNPROTECT/HIDE/UNHIDE CELLS | Excel Programming | |||
Unprotect only certain cells after macros runs to unhide range of | Excel Programming |