+ Reply to Thread
Results 1 to 33 of 33

Winzip - Quick way to zip up files from different path?

  1. #1
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Winzip - Quick way to zip up files from different path?

    Hi

    I have a folder that contain a list of files in shortcut type. So that i can just click it without going to different drives and paths to open those files and it really save my time.

    After updating those files, i need to zip it up. There are many files to zip up and it takes time by going to its path one by one. Do you guys know is there any method to zip up those files without going to its relevant drives and paths?

    Thanks
    Last edited by mingali; 09-02-2009 at 06:33 AM.

  2. #2
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Thanks for your prompt answer.

    as you are aware, my goal is to take less time to zip up those files.

    Does the first method requires me to go to all the drives and paths to copy those files to the common folder after i update the files everytime?

    Unfortunately, the second method is out of question as my company does not allow us to instal any software.

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Winzip - Quick way to zip up files from different path?

    Rin de bruin has some solutions at his site

  4. #4
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    i just tried an experiment. when the files in the folder are shortcut type, the zip up version is also shortcut type. So it doesnt work in this way.

    you mentioned double click the files, does it mean i need to open the file from the folder and zip it one by one? Some files are so large that it take two or three minutes to open. So in fact, it is slower than going to different path. If it is not what you meant, can you please give me a clearer explanation as i have misunderstood?

    FYI, after updating those files, i need to close it for my boss to review. After he reviewed only then i zip those files up.

    Thanks
    Last edited by mingali; 08-27-2009 at 07:35 AM. Reason: to add FYI line

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    Maybe this will help you collect a copy of the orginal files, based on the shortcut information, into the folder of short cuts.

    Then you can select all .xls files and zip. Once you have a zip you can delete the copied .xls files

    Please Login or Register  to view this content.
    So I have a folder in C:\temp called MyShortcuts. This folder contains shortcuts to xls files in other locations.
    The code currently only displays information in the immediate window about which files and where they are stored.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Arthurbr & Andy,

    I dont know how to use Marco. So i am not sure how to apply it. Sorry about it.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    Open new workbook.
    ALT+F11 to go to vbe
    Insert Module
    Paste code

    CTRL+G to display immediate window, where the output will be displayed

    Change folder locations names to suit your setup

    With the cursor in the code F5 to execute code

    The immediate window should contain source and destination file details

    If all looks correct remove '' to un comment FileCopy command and re run.

  8. #8
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Andy,

    Thanks for your help. I think now i am really testing your patient. Hope you can bear with me.

    In your code:

    1) strPath = "C:\temp\MyShortcuts\" ............ i will need to change to my folder's location, right? eg strPath - "C:\user\mingali\desktop\new folder\"

    2) strFile = Dir(strPath & "*.lnk")............ i will need to change to "strFile = Dir(strPath & "P&L July09.xls") and keep repeat all the files name i want by rewrite (2)?

    In vbe,

    1) i pasted the code to module, then open immediate window. However, it is blank. Shall it show the output?

    I did not proceed further.

    Thanks again for your help

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    1) strPath = "C:\temp\MyShortcuts\" ............ i will need to change to my folder's location, right? eg strPath - "C:\user\mingali\desktop\new folder\"

    Correct, where 'new folder' contains all your shortcut, .lnk, files.

    Do not change any other codes.

    You need to press F5 to execute the code before output appears in the immediate window.

  10. #10
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    thanks.

    However, when i pressed F5. a error message pop up stating ''Compile Error User-defined type not defined" with "objWSH As WshShell'' being highlighted.

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    As I put in the code.

    "requires reference to Windows Scripting Host object model"

    To do this you need to use Tools > References in VBE and then browse for windows scripting host

  12. #12
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    I hope you are not running thin of your patient. I went to tools but reference cannot be selected. Any idea why?

    Thanks

  13. #13
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    Perhaps you IT have set it so you can not access them.

    You could try late binding code.

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    It works perfectly....well, at least at home. i will try again at work tomorrow.

    Thanks for your help ;-)

  15. #15
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    It did not work at workplace. When i click F5, nothing show up in the immediate window. I tried both version you provided. At my workplace, i can access to tools -> reference and i did tick 'windows scripting host object model'.

    What else may have gone wrong?

    Thanks

  16. #16
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    Add a line to the code to check it is running.

    Please Login or Register  to view this content.
    Does the word running appear in the immediate window?
    If yes then check the path name you are using is correct.
    if not then check macros are enabled and that you can run them

  17. #17
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    Thanks for your reply

    Add a line to the code to check it is running.
    Where shall i add this additional line?

    Does the word running appear in the immediate window?
    No


    if not then check macros are enabled and that you can run them
    How to check marcos are enabled?

  18. #18
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    You can literally add it any where within the routine.

    Try this, do you see the message boxes?

    Please Login or Register  to view this content.
    Last edited by Andy Pope; 08-28-2009 at 05:28 AM.

  19. #19
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Thank Andy.

    I will try it on Monday and let you know.

  20. #20
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    [QUOTE=
    Try this, do you see the message boxes?
    [/QUOTE]

    Yes, there are two message boxes. However, immediate window still remains blank.

    What is your suggestion for next step?

    Thanks

  21. #21
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    What did the second of the message boxes say?

    If it says 0, zero, then your file/folder is incorrect.

    If it has a value then it would suggest that the folder has not *.lnk files in it.

    If the folder is correct and has files then it could be you do not have permission to access that area.

  22. #22
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    There are numbers in the second box.


    If it has a value then it would suggest that the folder has not *.lnk files in it.

    How can i rectify this issue?

    If the folder is correct and has files then it could be you do not have permission to access that area.
    the folders are in share drive. i have shortcut type in my desktop. So 'that area' mean which area?

    Thanks

  23. #23
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    This will report files attempting to process.
    Do you see the message boxes?

    Please Login or Register  to view this content.

  24. #24
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Thanks Andy.

    I will try it tommorrow and let you know.

  25. #25
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    This will report files attempting to process.
    Do you see the message boxes?
    No. Nothing at all.

  26. #26
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    Then there are no *.lnk files in the folder you specified in the code.

    Assuming the folder is correct try changing the files to search for and see if anything is returned.

    Please Login or Register  to view this content.

  27. #27
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    I will try it tomorrow and see how it goes.

    FYI, i did create another new folder in my desktop with different filenames and to see whether the macro (the one you provided yesterday) can be executed or not. Unfortunately, no message box also.

    Today, i just zipped up those files one by one and it took me about one hour. I really hope your macro can run at my workplace PC so that i can have an easier life.

    How come it works in my home PC but not office PC?

    Thanks

  28. #28
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    How come it works in my home PC but not office PC?
    If I knew I would tell you.

    You may have to get you IT guys involved to hunt down the reason for it not working on your work pc, as the code itself acutally works as you have demonstrated on your home pc.

  29. #29
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2010 (office) 2013 (home)
    Posts
    256

    Re: Winzip - Quick way to zip up files from different path?

    Hi Andy,

    It works now!!!! Yahoo!!!

    I asked an IT guys to look into it. He did something on my PC and then your code works!!!! How happy I am now ;-)

    Thank you very much. Your code save me about an hour time a month. Have seen how powerful marco is, now i am learning it. Hopefully, i can learn and understand it faster so that i can apply it to my job and save me more time for more relevant work.

  30. #30
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Winzip - Quick way to zip up files from different path?

    Glad you got it working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1