Hi Paul, I have not automated Word much.. so these are just some thoughts:
Have you already tried these ideas? 1) export from Word as MHT (images will be emebedded with the html file to reduce file clutter), then open the file in Excel. 2) Open the document in Word, Select All, Copy >> Excel: Paste 3) Print the word file to PDF, then use the Acrobat OLE automation (or perhaps some third-party PDF component) -- I think it's called the Interapplication Communication API -- to retrieve the document contents. Not even positive it offers that functionality. 4) Embed the Word document in your Excel file as-is. 5) Embed a PDF of the word document in your Excel file (if you want a "standard format" form consistency) I just tried the first two ideas, and although they brought everything over, the images sometimes were placed on top of the text. As to parsing an HTML file which you mentioned: I would think inline images would appear in the HTML file inline with the text. Their IMG tag should appear among the text where the image should be placed. Images anchored to the page might include CSS layout information to plcae them correctly and don't necessarily appear inline with the text that they are displayed next to. Accurately parsing all the layout data and covnerting it to display on a worksheet sounds problematic to me. Without some form of embedding, I don't think you'll be able to duplicate all aspects of the Word layout even if you read it accurately from the Word object model. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Paul Schreiner Sent: Friday, June 29, 2012 7:41 AM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Copy JPG images from Word into Excel I'm sorry, but here's the longer version of the story: I have an Oracle database. I use Excel as a front-end to the database. The Excel application is used to store and retrieve over 60,000 "documents" Each "document" consists of 2 to 130 sheets. Reporting tools allow me to search the content of all the documents very quickly. The application includes over 30,000 lines of VBA code (There is MUCH more going on with this application beyond storage and retrieval) I am now in the process of converting/loading over 3,000 "inspection" documents into this application. Unfortunately, the people who "Designed" the inspection documents chose to use a Word Processing program instead of a spreadsheet. (the oldest documents were originally in WordPerfect, then later converted to Word) I've moved most of the Word documents into specific folders. I now am writing VBA code (in Excel) to open each of the Word Documents, read the document and place the data into appropriate cells of the Excel templates. I successfully used: Set DocRange = mWord.ActiveDocument.Range(Start:=0, End:=0) DocRange.wholestory TxtArray = Split(DocRange.Text, Chr(13)) to loop through the TxtArray and populate the rows of the Excel file. ---------------------------------------------------------------------------- --------------------- My problem now is that many of the documents contain image files. ---------------------------------------------------------------------------- --------------------- I have spent 30+ hours searching and testing various approaches... I've discovered that while Excel utilizes the Shapes collection, SOME of these images in my Word files are found in the InlineShapes collection. With this code: For Each iShape In ActiveDocument.InlineShapes iShape.Select Selection.Copy Next iShape I am able to copy each shape to the ClipBoard, and I'm confident that I could switch to the Excel application and Paste it. I have also tried saving the Word document in HTML format, which effectively copies out all of the images (which is REALLY nice). However, I have another problem. I cannot seem to be able to figure out WHERE the shape is in the Word file. According to the documentation, InlineShapes are attached to a Range object (which is not quite the same as a Range in Excel) But I cannot seem to be able to figure out how to determine which LINE the image is attached to! And I haven't had any luck reading the HTML documents to determine placement. Any ideas? Paul ----------------------------------------- "Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can." - John Wesley ----------------------------------------- -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com