View Single Post
 
Old 09-22-2025, 07:02 AM
kilroyscarnival kilroyscarnival is offline Windows 10 Office 2021
Expert
 
Join Date: May 2019
Posts: 362
kilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nice
Default Troubleshooting Excel VBA performing Word operation

Hi,

I've got various older "photo logs" that coworkers made in Excel, all over our shared drive, and many of them are huge because pictures were not compressed. I've been trying to free up drive space by eliminating duplicates and reducing photos, but the ones in "photo logs" are in tables in Word documents.

I have a list of those in Excel (thanks to PowerQuery) and have eliminated any less than a year old. I'd like to run a macro that would open each file based on the path in column A of "this workbook" (current workbook) and compress all pictures, save and close. (Office 365 for Business, V 2508, on a Windows 10 PC)

I've got a few stumbling blocks, so I'll ask them separately.

First, various sources say I must first hit ALT+F11 and check the Microsoft Office 16.0 Object Library before using a macro that references Word from within Excel. But this box was already checked. And I kept getting an error on the line

Code:
dim wordApp As Word.Application
So I tried checking also the Microsoft Word 16.0 Object Library, then also tried moving it upward in priority. Should I have to do this? Or did this mess something up?

After I did re-prioritize Word in the Excel VBA, I did get the macro to run, but not to satisfaction. Details to follow.

Last edited by kilroyscarnival; 09-22-2025 at 07:29 AM. Reason: Edited to change active file path column to A; was H in my first attempt.
Reply With Quote