Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm a bit of a backup fanatic, and realised that I can auyomate most of my
backups by macro, which is great. The only problem is that the help in VB is too damn general for a novice. It just says FileSystemObject.Copyfolder, but doesn't tell you how to express a FilesystemObject. I can successfully copy files so I modified the code, and of course it doesn't work! I used: Sub BACKUP_CENTRAL_DATA() Dim SourceFolder, DestinationFolder SourceFolder = "C:\0. CENTRAL DATA\" DestinationFolder = "C:\99. BACKUPS\0. CENTRAL DATA\" FileCopy SourceFolder, DestinationFolder End Sub Can someone help me on this simple one please? Also I note that when I try to copy some of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Brett
You can duplicate a complete folder like this: Sub CopyFolder() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject fso.CopyFolder "c:\old", "c:\new" End Sub Courtesy of Jim Rech (MVP) Regards Trevor "Brettjg" wrote in message ... I'm a bit of a backup fanatic, and realised that I can auyomate most of my backups by macro, which is great. The only problem is that the help in VB is too damn general for a novice. It just says FileSystemObject.Copyfolder, but doesn't tell you how to express a FilesystemObject. I can successfully copy files so I modified the code, and of course it doesn't work! I used: Sub BACKUP_CENTRAL_DATA() Dim SourceFolder, DestinationFolder SourceFolder = "C:\0. CENTRAL DATA\" DestinationFolder = "C:\99. BACKUPS\0. CENTRAL DATA\" FileCopy SourceFolder, DestinationFolder End Sub Can someone help me on this simple one please? Also I note that when I try to copy some of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Trevor. Any clues on the second part of the (rather long) question -
about permission denied? Brett "Trevor Shuttleworth" wrote: Brett You can duplicate a complete folder like this: Sub CopyFolder() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject fso.CopyFolder "c:\old", "c:\new" End Sub Courtesy of Jim Rech (MVP) Regards Trevor "Brettjg" wrote in message ... I'm a bit of a backup fanatic, and realised that I can auyomate most of my backups by macro, which is great. The only problem is that the help in VB is too damn general for a novice. It just says FileSystemObject.Copyfolder, but doesn't tell you how to express a FilesystemObject. I can successfully copy files so I modified the code, and of course it doesn't work! I used: Sub BACKUP_CENTRAL_DATA() Dim SourceFolder, DestinationFolder SourceFolder = "C:\0. CENTRAL DATA\" DestinationFolder = "C:\99. BACKUPS\0. CENTRAL DATA\" FileCopy SourceFolder, DestinationFolder End Sub Can someone help me on this simple one please? Also I note that when I try to copy some of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Trevor
This is the exact code that I put in, but it gives a compile error of "User-defined type not defined" Sub BACKUP_Achiever_logo() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject fso.CopyFolder "C:\2006-aaalogo\", "C:\99. BACKUPS\2006-aaalogo\" End Sub Thanks, Brett Also I note that when I try to copy some of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Option Explicit
Sub CopyFolder() Dim fso As Object Set fso = CreateObject("scripting.FileSystemObject") fso.CopyFolder "c:\old", "c:\new" End Sub Notice that there are no trailing backslashes, too. And maybe you don't have permission to copy folders from blah blah... And if you're copying files, you may want to look at VBA's filecopy statement. ====== And another thought. You may like this program. http://www.karenware.com/powertools/ptreplicator.asp I like it because it's simple to set up and has enough settings that can turn off all the features I don't like. (I want just straight old copy|paste backups.) Brettjg wrote: Hi Trevor This is the exact code that I put in, but it gives a compile error of "User-defined type not defined" Sub BACKUP_Achiever_logo() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject fso.CopyFolder "C:\2006-aaalogo\", "C:\99. BACKUPS\2006-aaalogo\" End Sub Thanks, Brett Also I note that when I try to copy some of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I think Dave has answered the question about the code.
With regard to the permissions, I suggest you try to copy the files/folders manually and see what messages, if any, you get. Certainly, if you've got Outlook open, I'd expect you to have problems copying files that it is using or has recently accessed. Regards Trevor "Brettjg" wrote in message ... Hi Trevor This is the exact code that I put in, but it gives a compile error of "User-defined type not defined" Sub BACKUP_Achiever_logo() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject fso.CopyFolder "C:\2006-aaalogo\", "C:\99. BACKUPS\2006-aaalogo\" End Sub Thanks, Brett Also I note that when I try to copy some of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On 12 Mar, 19:09, "Trevor Shuttleworth"
wrote: I think Dave has answered the question about the code. With regard to the permissions, I suggest you try tocopythe files/folders manually and see what messages, if any, you get. Certainly, if you've got Outlook open, I'd expect you to have problems copying files that it is using or has recently accessed. Regards Trevor "Brettjg" wrote in message ... Hi Trevor This is the exact code that I put in, but it gives a compile error of "User-defined type not defined" Sub BACKUP_Achiever_logo() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject fso.CopyFolder "C:\2006-aaalogo\", "C:\99. BACKUPS\2006-aaalogo\" End Sub Thanks, Brett Also I note that when I try tocopysome of the files it says permission denied. The files are as follows: SourceFile = "blah blah\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls" SourceFile = "blah blah\My Documents\New Settings File.OPS" SourceFile = "blah blah\Application Data\Microsoft\Outlook\Outlook.NK2" SourceFolder = "blah blah\bgregory.DFS.000\Cookies\" SourceFolder = "blah blah\Favorites\" SourceFolder = "blah blah\Start Menu\" I didn't run the code from PERSONAL.XLS Thanks in advance. Brett- Hide quoted text - - Show quoted text - Hi I'm not to sure of your setup, if or why your backing files/folders the way you are however i came across this free vbs backup script, this script itself may not be of any use to you but the code inside may. have a look at www.dustan.co.uk Ta Trev |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to create a folder and copy files | New Users to Excel | |||
Copy a folder and objects | New Users to Excel | |||
save a backup copy in different folder | Excel Discussion (Misc queries) | |||
Macro to copy range from Excel files in folder | Excel Discussion (Misc queries) | |||
Copy files from spreadsheet into folder | Excel Discussion (Misc queries) |