Consulting

Results 1 to 2 of 2

Thread: FileSystemObject.DeleteFolder

  1. #1

    Unhappy FileSystemObject.DeleteFolder

    Hello
    I am having this problem.I make a folder from VBA to save the document as HTML, then after getting the images from that folder i want to delete the folder........but when i try to delete it, RunTime Error 70, Access Denied occurs... i guess its happening because the createFolder method holds it,

    ne solution ?

    Following is code that i am using.....

    Private Sub CreateFolder()
    Dim fso
    Dim fol As String
    fol = Application.StartupPath & "\tmpHTML"
    Set fso = CreateObject("Scripting.FileSystemObject")
    If Not fso.FolderExists(fol) Then
    fso.CreateFolder (fol)
    End If
    End Sub

    Private Sub deleteFolder()
    Dim fso
    Dim fol As String
    fol = Application.StartupPath & "\tmpHTML"
    Set fso = CreateObject("Scripting.FileSystemObject")

    If fso.FolderExists(fol) Then
    SetAttr fol, vbNormal
    fso.DeleteFolder fol, True
    End If
    End Sub

  2. #2
    Hello
    well solved it. the error was bieng generated cuz when i save the document as HTML, the ActiveDocument start pointing to the new htm file, and as it is opened , so it can't be deleted....
    Solution:i saved it back to its original location as .doc and then deleted the html folder...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •