Results 1 to 10 of 24

Thread: Get Pictures from Word Documents in All Sub Folders

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Aug 2021
    Posts
    13
    Rep Power
    0
    Hi Alan,
    I tested the code after commenting the lines as per your instructions.

    The code was copied in the Word file and also in the Normal template.
    Finally it created the 3 folders but before that the following happened.

    When I run the code - see attached images
    1) Message Box popped up - Something went wrong. There is no new folder produced. I press Ok then step 2
    2) Run-time error permission denied - I press Debug then Step 3
    3) It highlights the code (see yellow) - image Error

    So now the MovedToHere folder is created but there are no images in this folder.

    For your information the original Macro used to keep the Word Document open and create the Folder MovedToHere and the images were there in the folders.

    Thanks a lot for all the time and help.
    Attached Images Attached Images
    Last edited by prkhan56; 09-23-2021 at 01:35 PM. Reason: Images were not uploaded

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Hi
    I think the issues are getting far too complicated now for me to help with at this distance over the internet in a help forum.
    As I mentioned at the outset , I don’t have a lot of experience with these sort of Word codings.

    As I expect you will realise, if you have read and understood the coding, that Message Box is telling you that …. something went wrong – the folder, MovedToHere , was not made as it should have been.
    That problem does not happen here on any of my computers.

    But then you say the folder was made. It’s all very confusing and not really possible for me to help here without spending many many hours of testing to try and repeat the error and problems that you are getting.


    permission denied” sounds like you are not being allowed to delete the files. There may be some file or folder protection issues of which I have no experience with.


    I don’t think I can help any more. I am out of ideas. I lack the experience with this sort of Word and Image coding. Sorry.



    Your best option would be to find someone to help you in person, or try at other forums where a lot more experienced people are. Remember to refer them to this Thread, as I mentioned previously.

    I think also, you should now understand all about the coding and how it works. So you should be able to experiment yourself and find the problem.
    If you do not understand any of the coding, I will gladly explain anything again in more detail.

    Possibly you should start again yourself: Begin by writing smaller code bits to do some of the things, like making a folder, maybe another code to copy a file etc. , etc. Convince yourself you know what is going on.

    Good luck
    If you get it all sorted, please tell us where and how. Tell us also please if you post the question in other forums. Thanks.
    Alan



    P.s. …
    Quote Originally Posted by prkhan56 View Post
    ...
    The code was copied in the Word file ....
    You still have not told me what word file??? – see my previous comments.
    Last edited by DocAElstein; 09-24-2021 at 10:05 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. #3
    Junior Member
    Join Date
    Aug 2021
    Posts
    13
    Rep Power
    0
    Hello Alan,
    The code is in the file you sent me back.
    Anyway, I want to thank you for all the time and help you did for me.
    I will put it on other forum as my expertise in VBA is very minimal.

    Thanks once again.

  4. #4
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Hi
    Quote Originally Posted by prkhan56 View Post
    The code is in the file you sent me back
    That explains why the macro stops when at the close - The macro is there , running, but then you close it, so its gone.
    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

    Important: You can stop a macro like this by closing the document with the macro in it. But it is dangerous to do it.
    It is like if you are in a plane and want to land. So you take the engine away. The plane will come down. If you are lucky it will come down and stop. If you are unlucky the plane may crash. You may die.
    You can stop a macro like this by closing the document with the macro in it. If you are lucky the macro will stop. If you are unlucky your computer may crash. It may die.




    Also: A .docx cannot hold a macro - you can try it - try to save a .docx file with a macro in it. - It will not work
    A macro can go in normal template or in a docm file

    Good luck
    Please let us know how you get on.
    Alan
    Last edited by DocAElstein; 09-29-2021 at 03:22 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
  •