I have searched for a way to program a macro to automate picture compression, and have found numerous options listed online. The only problem is that none of them seem to work for Excel 2013.
I received a last-minute upgrade to Office (2010 to 2013), and now some of my macros no longer work.
Below are come code examples that I have found online and tried.
Examples:
This seems to work fine for older versions of Office (pre 2007)Code:Dim octl As CommandBarControl Set octl = Application.CommandBars.FindControl(ID:=6382) Application.SendKeys "%e~~" octl.Execute
__________________________________________________ __________________
This seems to work for Office 2007 & 2010Code:Application.SendKeys "%(oe)~{TAB}~" Application.CommandBars.ExecuteMso "PicturesCompress"
__________________________________________________ __________________
These are options that I have tried for 2013, and have had no success so far...
__________________________________________________ ____________________Code:If Application.Version >= 14 Then 'Application.SendKeys "a", True 'Application.SendKeys "s", True 'Application.SendKeys "{Enter}", True 'Application.CommandBars.ExecuteMso "PicturesCompress" 'Pic.Activate 'SendKeys "%JP", True 'SendKeys "%m", True 'SendKeys "ae", True 'SendKeys "Enter", True Dim octl As CommandBarControl Set octl = Application.CommandBars.FindControl(ID:=6382) Application.SendKeys "%e~" Application.SendKeys "%a~" octl.Execute End If
I can use Application.CommandBars.ExecuteMso "PicturesCompress" in order to open the dialog box, but sendkeys don't seem to have focus on the pop-up window.
I would prefer to not leave the choices up to the end-user if at all possible.
Any help would be greatly appreciated.
Edit: Please use code tags when posting codes. This time I added for you.




Reply With Quote
Bookmarks