Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Backing up my folders

Hi all,

Just wondering how I can back up a complete directory folder containing all
the .xls files I have. I have setup a macro that save certain file and back
them up but I would like to have the complete file copied and saved into
I:\backup\with today's date as the folder name.

Is there anyway to do this?

Thanks

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Backing up my folders

Greg, you could try this.

Sub Archive(YourDir As String)
Dim ArchiveDir As String
Dim thisFile As String

'Create the archive Directory
ArchiveDir = "I:\Backup\" & Format(Date, "dd-mm-yyyy")
If Dir(ArchiveDir, vbDirectory) = "" Then MkDir ArchiveDir

'Copy the files
thisFile = Dir(YourDir & "\*.xls")
While thisFile < ""
FileCopy YourDir & thisFile, ArchiveDir & "\" & thisFile
thisFile = Dir
Wend
End Sub

Good luck,
Fred


"Greg B" wrote in message
...
Hi all,

Just wondering how I can back up a complete directory folder containing

all
the .xls files I have. I have setup a macro that save certain file and

back
them up but I would like to have the complete file copied and saved into
I:\backup\with today's date as the folder name.

Is there anyway to do this?

Thanks

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Backing up my folders

Greg,

The ubiquitous FileSystemObject is one way

'---------------------------------------------------------------------------
Sub CopyFolder()
'---------------------------------------------------------------------------
Dim oFSO As Object
Dim sFolder As String

Set oFSO = CreateObject("Scripting.FileSystemObject")
sFolder = "I:\Backup\"
If Not oFSO.FolderExists(sFolder) Then
MkDir sFolder
End If
If Not oFSO.FolderExists(sFolder & Format(Date, "yyyy-mm-dd")) Then
MkDir sFolder & Format(Date, "yyyy-mm-dd")
End If
oFSO.CopyFolder "C:\myTest\*", sFolder & "\"
Set oFSO = Nothing
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Greg B" wrote in message
...
Hi all,

Just wondering how I can back up a complete directory folder containing

all
the .xls files I have. I have setup a macro that save certain file and

back
them up but I would like to have the complete file copied and saved into
I:\backup\with today's date as the folder name.

Is there anyway to do this?

Thanks

Greg




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
backing up joesf16 Excel Discussion (Misc queries) 4 September 16th 07 01:15 PM
Backing up folder dan Excel Discussion (Misc queries) 4 July 21st 06 04:16 AM
Backing Up Greg B Excel Discussion (Misc queries) 7 March 4th 05 03:45 PM
Backing Up Greg B Excel Worksheet Functions 7 March 4th 05 03:45 PM
Backing up IE Favorites Spammastergrand Excel Programming 3 February 19th 05 11:42 PM


All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"