Thread: defined object
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default defined object

I am getting a Compile error: message with the following Macro which was
working before.
The macro was to backup a folder "shortxls" as "shortxlsmmddyy"

Sub MDshortxlsmmddyy()
Dim myOldFolder As String
Dim myNewFolder1 As String
Dim datecode As String
Dim FSO As Scripting.FileSystemObject
' The statement above kick out an error "User-defined type not defined"
datecode = Format(Date, "mmddyy")
Set FSO = New Scripting.FileSystemObject
myOldFolder = "D:\Documents and Settings\Dan\Desktop\shortxls"
myNewFolder1 = "D:\MyBackup\all shortxls\shortxls" & datecode
If FSO.FolderExists(myOldFolder) Then
If FSO.FolderExists(myNewFolder1) = False Then
FSO.CopyFolder Source:=myOldFolder, _
Destination:=myNewFolder1
Else
MsgBox "Not Copied in all shortxls!"
End If
End If
End Sub

Please Help,
Thanks