Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Get Pictures from Word Documents in All Sub Folders

  1. #21
    Junior Member
    Join Date
    Aug 2021
    Posts
    13
    Rep Power
    0
    Dear Alan,
    I had some issues with my laptop and just got it fixed.

    I had mentioned in my previous post #17 that I have test the macro both in the file as well is the Normal Template, probably you missed it.

    Now what I am going to tell would surprise you as it has surprised me as well.
    When I run the macro the folder 2_ KEEP DUPLICATE RECORDS files got created with the error and debug message as posted previously.

    The file was in the download folder and the macro was in the Normal template.

    When I run the macro. All my files - I mean all docx, xlsx, pptx, jpgs etc etc moved to some where I don't know where.

    There is really strange. I am just sharing this with you that this has happened in my download folder.
    I have tried looking for it in other folders and I could not find it anywhere in my hard drive.

    All the folders are intact but the files have moved to some where I have not idea what so ever.

    Not a single files is there in the download folder. Only folder remains

    I really appreciate all the help and time you have taken to look up in this matter. But now this files disappearing is something I thought I would share with you.

    Thanks once again.

  2. #22
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Hi
    Quote Originally Posted by prkhan56 View Post
    ...I had mentioned in my previous post #17 that I have test the macro both in the file as well is the Normal Template, probably you missed it.
    I did not miss it, but I did not know what file you meant by the file . But you cleared that up in post #19, so all was then OK, I understood after post #19.





    Did you see and understand my last reply here, post #20 https://excelfox.com/forum/showthrea...ll=1#post15657 ?
    I tried to explain in post #20 that it is bad and stupid to put the macro in that .docx file

    You should never put any macro in a _.docx file
    You should never put a macro in a particular file if that particular file is closed by that macro.
    -
    Quote Originally Posted by DocAElstein View Post
    .....
    If you run a macro that is in a document and that macro closes the document, then nothing can happen after the close because both the document and macro is no longer there.
    It is like driving a car on a journey, and on the way, in the middle of the journey, God comes and takes your car and the engine away. So the journey stops

    Like this
    WORD: [document and start macro running ]
    WORD: [document and macro running ]
    WORD: [document and macro running - macro closes the document ]
    WORD: [ _________________________ ]
    - all is gone. There is nothing there - no document , no running macro. Macro cannot finish - there is no macro - its gone because you closed it

    .....





    Quote Originally Posted by prkhan56 View Post
    ...... All my files - I mean all docx, xlsx, pptx, jpgs etc etc moved to some where I don't know where.

    There is really strange. ......
    I have tried looking for it in other folders and I could not find it anywhere in my hard drive.

    All the folders are intact but the files have moved to some where I have not idea what so ever.

    .....
    I have sometime experienced that problem. Sometime that might happen if the place you intended saving is temporarily not available. Sometimes when this happens the files are saved in some default place. Exactly where will be different for every computer.
    On my computers they might go somewhere like
    C:\Users\Elston\Documents
    Or
    C:\Windows\System32
    Or
    C:\Program Files\Google\Chrome\Application\49.0.2623.112
    Those are just some examples

    Every computer will be a bit different. ( But it often goes to the same place, so if you do find where, it would be wise to make a note of the path, as I have done )

    One way to find w]here this strange place is, is to save something firstly on an external USB stick. Then remove the USB stick and try to save again. Sometime your computer will then try to save in the strange place because it cannot find the correct place, because you removed the correct place.( Foa a particular computer, it often goes to the same place, so if you do find where, it would be wise to make a note of the path )

    Alan
    Last edited by DocAElstein; 10-05-2021 at 10:33 AM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  3. #23
    Junior Member
    Join Date
    Aug 2021
    Posts
    13
    Rep Power
    0
    Dear Alan,

    Thanks for your reply and also sharing your experience of similar problem.
    I am aware of the docx and docm files and their respective properties.

    My question is, why did it happened after running the macro in the Normal Template. My knowledge of VBA is very minimal so I could not what happened after running the code.

    In case the files have been moved then it should be found on the system (somewhere). I checked the path you suggested. I tried various utilities to check whether it is moved or deleted but to no success.

    It is just not there any where on the system.
    Is the code renaming the files and moving or deleting them?

    Hope you understand my point now.

  4. #24
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Hi
    Quote Originally Posted by prkhan56 View Post
    .., why did it happened after running the macro in the Normal Template.
    I don’t know. I have not yet experienced that problem.


    Quote Originally Posted by prkhan56 View Post
    ...
    Is the code renaming the files and moving or deleting them?
    The macro uses the VBA Name Statement
    https://docs.microsoft.com/en-us/off...name-statement - ...... The Name statement renames a file and moves it to a different directory or folder, if necessary ……

    The exact processes involved may be a secret that Microsoft would not ell us. But you can test yourself and experiment yourself with simple coding so as to learn and understand what finally happens.

    Example 1: Move
    Make a folder, anywhere, for example on your desktop https://i.postimg.cc/SQDZbxwk/Make-a...ur-desktop.jpg
    Put two folders in it https://i.postimg.cc/Gt7zFXkH/Put-two-folders-in-it.jpg
    Put any file in SubFolder1 https://i.postimg.cc/2y82LsLs/Put-an...ub-Folder1.jpg

    So now we have a file in SubFolder1 and SubFolder2 is empty https://i.postimg.cc/bNrmyjhb/a-file...2-is-empty.jpg

    Now run a simple test macro like this
    Code:
    Sub TestWhatVBANameStatementDoes()
    Dim strPath As String: Let strPath = "C:\Users\Elston\Desktop\Temporary\" ' --- CHANGE TO SUIT YOUR PATH
     Name strPath & "SubFolder1\Neues Textdokument.txt" As strPath & "SubFolder2\Neues Textdokument.txt"
    End Sub
    After running that macro you will see that the file is now in the other folder only https://i.postimg.cc/XJgsJjqK/the-fi...older-only.jpg

    Before running macro:
    a file in SubFolder1 and SubFolder2 is empty.JPG



    After running macro:
    the file is now in the other folder only.JPG




    Example 2: Move and rename
    Make a folder, anywhere, for example on your desktop https://i.postimg.cc/SQDZbxwk/Make-a...ur-desktop.jpg
    Put two folders in it https://i.postimg.cc/Gt7zFXkH/Put-two-folders-in-it.jpg
    Put any file in SubFolder1 https://i.postimg.cc/2y82LsLs/Put-an...ub-Folder1.jpg

    So now we have a file in SubFolder1 and SubFolder2 is empty https://i.postimg.cc/bNrmyjhb/a-file...2-is-empty.jpg

    Now run a simple test macro like this
    Code:
    Sub TestWhatVBANameStatementDoes()
    Dim strPath As String: Let strPath = "C:\Users\Elston\Desktop\Temporary\" ' --- CHANGE TO SUIT YOUR PATH
     Name strPath & "SubFolder1\Neues Textdokument.txt" As strPath & "SubFolder2\New Name.txt"
    End Sub
    After running that macro you will see that the file is now in the other folder only https://i.postimg.cc/9fjmHhkt/the-fi...a-new-name.jpg and also it has a new name

    Before running macro:
    a file in SubFolder1 and SubFolder2 is empty.JPG



    After running macro:
    the file is now in the other folder only and has a new name.JPG


    Alan
    Last edited by DocAElstein; 10-06-2021 at 01:32 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

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
  •