Permission problems moving file in VB using CreateObject
Posted on 2004-10-11
I have a application which builds an XML file and then moves it to other PC's, but also keeps a copy in an archive directory. I am trying to use the FileSystemObject to move the file, but keep getting a 'Permission Denied' error. I have tried making the directories shared but does not solve the problem.
Also, the app is run from the StartUp directory when the user logs onto his PC.
Public Sub TransportFiles()
Dim fs As Object
On Local Error GoTo ErrorTransportFiles
' XML FILES CREATED HERE IN C:\OUTGOINGPATH
Set fs = CreateObject("Scripting.FileSystemObject")
fs.MoveFile (Trim(strOutgoingPath) & "*.xml"), (Trim(strOutgoingArchPath))
Set fs = Nothing
Err_Number = Err.Number
Err_Desc = Err.Description
Err_Source = Err.Source
If Err_Number = 70 Then ' Permission problem
MsgBox "Permission to Move Denied"
ElseIf Abs(Err_Number) = 53 Then ' file not found
ElseIf Abs(Err_Number) = 58 Then ' file not found
Is there another method of doing this within code?