+ Reply to Thread
Results 1 to 3 of 3

zip folder contents

  1. #1
    Registered User
    Join Date
    04-03-2018
    Location
    ENGLAND
    MS-Off Ver
    2013
    Posts
    2

    zip folder contents

    Hi all, I'm Rick. New to site and new to VBA also. I started to learn VBA about 3-4 weeks ago and am enjoying it massively. my thirst for knowledge grows with every line of code I write! anyway...

    I have a small project and I am one action away from it being complete. in a nutshell I have a small database of suppliers, each has their own dedicated folder containing their documents. basically the macro works down the list and for each row counts the number of files in the supplier folder and returns the count to a cell in a different column on the active row. (i.e for cell reference "A1" it counts all the files in folder "A" and returns the count value to cell "H1").

    at this point the macro needs to do one of two things:

    if the file count <= 5 then
    (create and send email, adding all attachments individually)
    else
    'THIS IS WHERE ZIPPING WOULD OCCUR
    end if

    this bit is working no problem at all but I want to zip the folders containing more than 5 documents prior to email. the reason I want top do this is because sometimes there are upwards of 50 ".pdf" documents within these folders and, although outlook will send these emails, nobody likes receiving an email with over 50 individual attachments!

    I have tried to use several codes I have found that all say "SOLVED" but I cant get any of them to work. I admit this is no doubt down to my inexperience and lack of knowledge but it is still frustrating as this is the last step in my programme.

    what I would like is this. I would like some coding that will "if the file count is > 5" then zip the contents of the supplier folder contents (and preferably delete the original version also so that when complete the supplier folder contains just the zip folder).

    please forgive my ignorance but is this something that is possible?

    can anyone help?

    thank you in advance for anything you can offer

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,165

    Re: zip folder contents

    Hi Rick and welcome to the forum,

    Zip is not something that VBA has built in. I find a few other posts that have tried to accomplish your task. Read about them at:

    http://www.rondebruin.nl/win/s7/win005.htm or
    https://answers.microsoft.com/en-us/...b-3773afdbc192
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    04-03-2018
    Location
    ENGLAND
    MS-Off Ver
    2013
    Posts
    2
    Hi thanks for the reply and the welcome. I have managed this now (after much googleage). When I return to my computer I will comment with the code I have used to achieve this. It works perfectly too!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copying contents of a folder and moving it to another
    By bbhockey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2015, 09:49 AM
  2. Merging folder contents
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2013, 06:14 PM
  3. hyperlinking to folder contents
    By infamousurge in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-28-2013, 12:02 PM
  4. Printing Folder Contents
    By nigelshaw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2012, 11:20 AM
  5. Printing folder contents
    By nigelshaw in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2012, 06:04 AM
  6. Search a Folder and Copy Contents
    By jacof in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2011, 11:18 AM
  7. [SOLVED] copying folder contents
    By jnewl in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2006, 07:15 AM

Tags for this Thread

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