اذهب الي المحتوي
أوفيسنا

permission denied عند نقل مجلد من القرص المحلي :\D إلى :\C


mr steev

الردود الموصى بها

السلام عليكم وكل عام وأنتم بخير بمناسبة عيد الأضحى المبارك

لدي هذا الكود يقوم بنقل مجلد من المسار الحالي إلى القرص المحلي  :\C

المشكلة لدي عندما يكون المسار الحالي لقاعدة البيانات في في قرص غير الـ :\C

يعطي رسالة permission denied

هذا هو الكود:

Private Sub Form_Load()
On Error GoTo MyErr
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
    
    FromPath = CurrentProject.Path & "\MyFolder"
    ToPath = "C:\MyFolder"

    If Right(FromPath, 1) = "\" Then
        FromPath = Left(FromPath, Len(FromPath) - 1)
    End If
    If Right(ToPath, 1) = "\" Then
        ToPath = Left(ToPath, Len(ToPath) - 1)
    End If

    Set FSO = CreateObject("scripting.filesystemobject")
    If FSO.FolderExists(FromPath) = False Then
        Exit Sub
    End If
    If FSO.FolderExists(ToPath) = True Then
        Exit Sub
    End If
    FSO.MoveFolder Source:=FromPath, Destination:=ToPath

MyErr:
If Err.Number <> 0 Then
MsgBox Err.Number & " - " & Err.Description
End If

End Sub

فما هو الحل ؟؟؟

وجزاكم الله خيراً

تم تعديل بواسطه mr steev
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information