+ Reply to Thread
Results 1 to 4 of 4

Reduce file size of multiple images with excel VBA

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    2

    Reduce file size of multiple images with excel VBA

    Hi all, happy new year!

    I've been attempting to tackle this for a while now but as my VBA skills are basic to say the least I'd really appreciate it if someone would be kind enough to give me a few pointers.

    As the title says, I'd like to reduce the file size of a number of image files (jpg) in a folder, and then save them as new files. To do this manually I normally use MS Paint, and so this has been my approach with VBA also. Here's the code that I have so far, shown for one file only (as the loop should be pretty simple);

    Please Login or Register  to view this content.
    However, I can't figure out how to specify the save location in the SaveAs window using SendKeys (the last three commented SendKeys lines above). Any help with this, or any recommendation for a simpler method than using SendKeys, would be very much appreciated.

    The wait function in the above code is necessary before AppActivate will work properly. The code was written by Russel Judge and found at http://vbcity.com/forums/t/81315.aspx ...

    Please Login or Register  to view this content.
    Many thanks in advance,

    Mott

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Reduce file size of multiple images with excel VBA

    Assuming you have Outlook installed. Select all your image files in the folder. Right click and select send to mail recipient. you will be given the option to reduce the size of the images. Select all the images in your new email and Save As. Overwrite the old ones.

    Assuming you don't have Outlook. Try this
    https://imageresizer.codeplex.com/
    Frob first, tweak later

  3. #3
    Registered User
    Join Date
    09-21-2012
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Reduce file size of multiple images with excel VBA

    Many thanks Neil, the Outlook method will certainly give me what I needed, so much appreciated! Would still be interested if there is a solution to SaveAs using SendKeys method though - any ideas?

  4. #4
    Registered User
    Join Date
    03-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Reduce file size of multiple images with excel VBA

    motmot11
    just add "SendKeys SaveLocation, True"

    like this:

    ' Need help with the following...
    SendKeys SaveLocation, True
    Application.SendKeys ("small_" & FileNom) ' specify the new file name *would like to also specify the SaveLocation*
    Application.SendKeys ("~") ' enter to accept the save with file name and location
    Application.SendKeys ("%FX") ' close MS Paint

+ 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. How to reduce the size of an Excel file?
    By aurel400 in forum Excel General
    Replies: 0
    Last Post: 02-11-2014, 12:09 PM
  2. Replies: 1
    Last Post: 12-17-2013, 03:18 PM
  3. How to reduce an Excel file size
    By Hesham.Sharara in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-18-2012, 08:36 AM
  4. Reduce Size for an Excel File
    By sajal.singh in forum Excel General
    Replies: 0
    Last Post: 03-16-2011, 07:42 AM
  5. Reduce the file size of Word file by removing all images in it
    By RosH in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2006, 01:15 AM
  6. [SOLVED] How can I reduce the size of my Excel file without zipping it?
    By Sizerd in forum Excel General
    Replies: 1
    Last Post: 02-13-2006, 08:10 AM
  7. [SOLVED] How do I reduce the file size of an Excel document?
    By Rebecca in forum Excel General
    Replies: 1
    Last Post: 01-24-2006, 12:10 AM
  8. [SOLVED] how to reduce file size of excel workbooks
    By Teri_2226 in forum Excel General
    Replies: 1
    Last Post: 10-24-2005, 12:05 PM

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