defined object
Dim FSO As Scripting.FileSystemObject
Maybe the code was written in a later version of Excel than what you are
using? Was this a new type in XL2003?
Using XL2000 I have to use
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
"dan" wrote:
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
|