Run Time Error 13

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?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I think I have solved my problem myself and was too quick to find a solution from the website

I must think things through more
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top