Helen Pippard
New Member
- Joined
- Dec 12, 2008
- Messages
- 47
Hello
I have searched the internet for esolutions similar to my VBA Code, but cabnot find how to fix my problem
I am getting a run time error on the following code
Public Function CopyData()
Dim fs As Object
Dim oldPath As String, newPath As String
Dim strPDFFilename As String
oldPath = "F:\Documents and Settings\user\My Documents"
newPath = "F:\Documents and Settings\user\My Documents\Misc"
Set fs = CreateObject("Scripting.FileSystemObject")
If FileDateTime("F:\Documents and Settings\user\My Documents\Misc\Query1.xls") >= FileDateTime("F:\Documents and Settings\user\My Documents\Query1.xls") Then fs.CopyFile "F:\Documents and Settings\user\My Documents\Query1.xls", "F:\Documents and Settings\user\My Documents\Misc\Query1.xls"
If FileDateTime("F:\Documents and Settings\user\My Documents\Misc\Query2.xls") >= FileDateTime("F:\Documents and Settings\user\My Documents\Query2.xls") Then fs.CopyFile "F:\Documents and Settings\user\My Documents\Query2.xls", "F:\Documents and Settings\user\My Documents\Misc\Query2.xls"
Set fs = Nothing
End Function
Any ideas how I can fix this?
I have searched the internet for esolutions similar to my VBA Code, but cabnot find how to fix my problem
I am getting a run time error on the following code
Public Function CopyData()
Dim fs As Object
Dim oldPath As String, newPath As String
Dim strPDFFilename As String
oldPath = "F:\Documents and Settings\user\My Documents"
newPath = "F:\Documents and Settings\user\My Documents\Misc"
Set fs = CreateObject("Scripting.FileSystemObject")
If FileDateTime("F:\Documents and Settings\user\My Documents\Misc\Query1.xls") >= FileDateTime("F:\Documents and Settings\user\My Documents\Query1.xls") Then fs.CopyFile "F:\Documents and Settings\user\My Documents\Query1.xls", "F:\Documents and Settings\user\My Documents\Misc\Query1.xls"
If FileDateTime("F:\Documents and Settings\user\My Documents\Misc\Query2.xls") >= FileDateTime("F:\Documents and Settings\user\My Documents\Query2.xls") Then fs.CopyFile "F:\Documents and Settings\user\My Documents\Query2.xls", "F:\Documents and Settings\user\My Documents\Misc\Query2.xls"
Set fs = Nothing
End Function
Any ideas how I can fix this?