#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


  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default defined object

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   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default defined object

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default defined object

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   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default defined object

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default defined object

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
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
Cannor strech embedded word object BartDesc Excel Discussion (Misc queries) 2 March 10th 06 08:15 AM
Object Frank Xia Setting up and Configuration of Excel 0 March 3rd 06 12:08 AM
SET statement tutorial Daminc Excel Discussion (Misc queries) 13 January 17th 06 04:47 PM
Creating a Powerpoint object (in XP onwards) with an ActiveWindow BizMark Excel Discussion (Misc queries) 0 August 12th 05 12:46 PM
VBA: Where to find Excel Object model? N. Foldager Excel Discussion (Misc queries) 13 February 6th 05 06:43 PM


All times are GMT +1. The time now is 06:45 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"