Results 1 to 10 of 24

Thread: Get Pictures from Word Documents in All Sub Folders

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Junior Member
    Join Date
    Aug 2021
    Posts
    13
    Rep Power
    0
    Quote Originally Posted by DocAElstein View Post




    Can you clarify: Do you mean it used to work for you? Do you mean that you previously have run the macro and had the macro working without error?




    You could try this quick test. It might help take us further, although I am not sure how, because I don’t relay know what’s going on..
    This modified macro should tell you if you have a file to be killed, just before the code line to kill which is giving you the error.
    It should tell you that you have at least one file there.
    ........

    This is the new bit
    Code:
    ' Test section
    Dim FileExistTest As String: Let FileExistTest = Dir(strPath & "\" & strDocumentName & ".htm*", vbNormal)
        If FileExistTest = "" Then MsgBox Prompt:="You don't seem to have any files to be killed": Debug.Print "You don't seem to have any files to be killed"
     
        Do While FileExistTest <> ""
         MsgBox Prompt:="You have this file to be killed:   " & FileExistTest: Debug.Print "You have this file to be killed:   " & FileExistTest
         Let FileExistTest = Dir     '   The use of Dir on its own, without any bracket ( ) stuff tells VBA to look again for the next file of the same type and in the same place that it looked the last time
        Loop
     
    Dear Alan
    Thanks a lot for taking time and submitting the test code.

    It pops up with a message box saying you don't have any files to be killed and when pressed Ok it highlights the same line as mentioned in my previous post.
    Yes, this macro used to work in the past absolutely fine. But for some reason it started behaving like this.

    I have noticed few things it does when you Click End on the Error dialogue box

    It creates two folders as follows: (I am attaching a sample word file on which I tested your code)
    Folder1 - 2_files - in this folder you will see that there are images (but they are in duplicates one in png and one in jpg format - this is also strange behaviour!), also you will see some xml and thmx files here.

    Folder2 - MovedToHere - there are no files here.

    and one file is created which is not associated with any other application.

    The sample file is attached herewith for you to test.

    Thanks once again for taking out the time to help me.
    Attached Files Attached Files
    Last edited by DocAElstein; 09-03-2021 at 09:44 AM.

Similar Threads

  1. Replies: 1
    Last Post: 08-26-2021, 11:42 AM
  2. Replies: 3
    Last Post: 07-09-2020, 02:17 AM
  3. Replies: 7
    Last Post: 08-24-2015, 10:58 PM
  4. Replies: 9
    Last Post: 07-26-2013, 02:34 PM
  5. Replies: 1
    Last Post: 10-16-2012, 01:53 PM

Posting Permissions

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