Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Make sure you have a reference to Microsoft Scripting Runtime (under
Tools|References in the VBE). I'm betting that you copied the code from one workbook (with the reference) to a different workbook that doesn't have that reference (yet!). 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 -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Dave,
Here is my history. My computer crushed. I restored it back to factory condition. Downloaded updates from Microsoft. I was setting up all my Excel files references, until I encountered the object problem. I changed the option to competible with previous version. I also enabled Microsoft Firewall in Excel. But I left Norton Firewall on. At each opening Excel, it was requesting a virus scan, but never finished it, even after several restart attempts. I removed the Office XP through Add/Remove and re-install it from the disk. Now all I get is the Excel background with no contents, not even requesting a virus scan. Always said "ready" in the status bar. Who might be able to help me? Desperately, Thanks "Dave Peterson" wrote in message ... Make sure you have a reference to Microsoft Scripting Runtime (under Tools|References in the VBE). I'm betting that you copied the code from one workbook (with the reference) to a different workbook that doesn't have that reference (yet!). 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 -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I don't use Norton, but I'd suggest disabling it (just temporarily) to see if
that helped. dan wrote: Hi Dave, Here is my history. My computer crushed. I restored it back to factory condition. Downloaded updates from Microsoft. I was setting up all my Excel files references, until I encountered the object problem. I changed the option to competible with previous version. I also enabled Microsoft Firewall in Excel. But I left Norton Firewall on. At each opening Excel, it was requesting a virus scan, but never finished it, even after several restart attempts. I removed the Office XP through Add/Remove and re-install it from the disk. Now all I get is the Excel background with no contents, not even requesting a virus scan. Always said "ready" in the status bar. Who might be able to help me? Desperately, Thanks "Dave Peterson" wrote in message ... Make sure you have a reference to Microsoft Scripting Runtime (under Tools|References in the VBE). I'm betting that you copied the code from one workbook (with the reference) to a different workbook that doesn't have that reference (yet!). 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 -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
No, it didn't.
"Dave Peterson" wrote in message ... I don't use Norton, but I'd suggest disabling it (just temporarily) to see if that helped. dan wrote: Hi Dave, Here is my history. My computer crushed. I restored it back to factory condition. Downloaded updates from Microsoft. I was setting up all my Excel files references, until I encountered the object problem. I changed the option to competible with previous version. I also enabled Microsoft Firewall in Excel. But I left Norton Firewall on. At each opening Excel, it was requesting a virus scan, but never finished it, even after several restart attempts. I removed the Office XP through Add/Remove and re-install it from the disk. Now all I get is the Excel background with no contents, not even requesting a virus scan. Always said "ready" in the status bar. Who might be able to help me? Desperately, Thanks "Dave Peterson" wrote in message ... Make sure you have a reference to Microsoft Scripting Runtime (under Tools|References in the VBE). I'm betting that you copied the code from one workbook (with the reference) to a different workbook that doesn't have that reference (yet!). 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 -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
And you're sure that the workbook isn't opening?
If you hit file|print preview, can you see anything? If you can, maybe the window is just off the screen. Window|arrange|tiled (and resize manually) But I'm pretty much out of ideas. dan wrote: No, it didn't. "Dave Peterson" wrote in message ... I don't use Norton, but I'd suggest disabling it (just temporarily) to see if that helped. dan wrote: Hi Dave, Here is my history. My computer crushed. I restored it back to factory condition. Downloaded updates from Microsoft. I was setting up all my Excel files references, until I encountered the object problem. I changed the option to competible with previous version. I also enabled Microsoft Firewall in Excel. But I left Norton Firewall on. At each opening Excel, it was requesting a virus scan, but never finished it, even after several restart attempts. I removed the Office XP through Add/Remove and re-install it from the disk. Now all I get is the Excel background with no contents, not even requesting a virus scan. Always said "ready" in the status bar. Who might be able to help me? Desperately, Thanks "Dave Peterson" wrote in message ... Make sure you have a reference to Microsoft Scripting Runtime (under Tools|References in the VBE). I'm betting that you copied the code from one workbook (with the reference) to a different workbook that doesn't have that reference (yet!). 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 -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cannor strech embedded word object | Excel Discussion (Misc queries) | |||
Object | Setting up and Configuration of Excel | |||
SET statement tutorial | Excel Discussion (Misc queries) | |||
Creating a Powerpoint object (in XP onwards) with an ActiveWindow | Excel Discussion (Misc queries) | |||
VBA: Where to find Excel Object model? | Excel Discussion (Misc queries) |