Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-05-2018, 06:22 PM
chaz chaz is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Novice
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order?
 
Join Date: Jul 2018
Posts: 3
chaz is on a distinguished road
Default How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order?

How do I get Word 2016 (either through a macro or through some third-party program) to change multiple selected pictures so that they appear in an order that I choose? For example, say I have 50 random pictures (all residing in their own separate cell of a word table). And then say I have 300 more in a folder somewhere. How do I have it so that I first choose which pictures I want (in the order I chose then like pic 40, pic 57, pic 23, pic 158, etc.) and then have the 50 pictures in the document be changed to the 50 new pictures I selected.





Currently, I have to manually select a picture, right-click and pick "change picture", select "from a file", choose which folder the new pictures reside in, then pick the one picture, and press insert. I have to do that for every picture and for my job that can be over 400 pictures!



You can see a portion of what the layout looks like in the attachment that I added. As you can see, I have the picture in one cell with a caption underneath and then blank space in the cell to the right (this is where I write other stuff). This repeats for however many rows and there are anywhere from 8 to 12 separate word tables in the document that look exactly like this.



Is there a macro or add-on that can do this? I'm not saying it has to do exactly what I said, but something close. Like maybe a macro that inserts new pictures in the specified order but inserts then in the same places or something. I couldn't find any third-party way of doing this so any recommendations will help.


One limitation is that I can't rename the pics so that they show up in the order I want as that would take nearly as long as before. Unless there's a program that can do that separately. If there is one that can order them, then it could be that a macro or something inserts the pictures in order. All I would have to then is form a table around all the pictures (I think).



Forgive me for the complexity of this problem and thank you guys for the help.
Attached Files
File Type: docx Example.docx (316.7 KB, 9 views)

Last edited by chaz; 07-05-2018 at 10:43 PM.
Reply With Quote
  #2  
Old 07-05-2018, 07:06 PM
Guessed's Avatar
Guessed Guessed is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I don't see an attachment.

The concept is achievable and the interface to allow you to select an order could be done a few different ways: vba userform; multi-select file chooser; input list of filenames in table/excel/etc. You might also need to start replacing the pictures from a particular point unless you are really sure about the completeness and correctness of the chosen order.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 07-05-2018, 11:06 PM
chaz chaz is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Novice
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order?
 
Join Date: Jul 2018
Posts: 3
chaz is on a distinguished road
Default

Sorry about that. Its added now.


I'm honestly not entirely sure what most of those things are, but I appreciate the feedback. I'm no programmer, but I'm willing to learn if this problem is not considered advanced.



Also I can promise that the order is pretty set in stone. All I ever do is maybe delete a picture or two out of the set.
Reply With Quote
  #4  
Old 07-06-2018, 12:19 AM
Guessed's Avatar
Guessed Guessed is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Try this code - the macro is called ReplaceImages. It is written to run from the current selection point to the end of the document and continuously open the usual dialog until it runs out of pictures in the document.
It doesn't include a method of breaking the code if choose to stop before reaching the end of the document. The logical way to do that would be to detect if a dialog was dismissed by pressing Cancel but I'm not sure how I would do that. Someone else might have a good idea on how to do that.
Code:
Sub ReplaceImages()
  Dim i As Integer, aRng As Range
  Set aRng = Selection.Range
  aRng.End = ActiveDocument.Range.End
  For i = 1 To aRng.InlineShapes.Count
    aRng.InlineShapes(i).Select
    funReplaceInlineShape aRng.InlineShapes(i)
  Next i
End Sub

Function funReplaceInlineShape(origShp As InlineShape) As Boolean
  Select Case origShp.Type
    Case msoAutoShape, msoFreeform, 6   'this is a shape with a picture fill
      CommandBars.ExecuteMso ("ObjectPictureFill")
    Case wdInlineShapePicture      'this is a picture placed into the doc
      If CInt(Application.Version) < 16 Then   'following only works pre Word 2016+
          CommandBars.ExecuteMso ("PictureChange")
        Else                    'following is for Word 2016+
          CommandBars.ExecuteMso ("PictureChangeFromFile")
      End If
  End Select
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 07-06-2018, 12:38 AM
gmayor's Avatar
gmayor gmayor is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

As there is nothing particularly significant about the document - it's a table with pictures. Why not simply create a new table with the pictures you want, in the order you want them - see http://www.gmayor.com/photo_gallery_template.html
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 07-10-2018, 05:25 PM
chaz chaz is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Novice
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order?
 
Join Date: Jul 2018
Posts: 3
chaz is on a distinguished road
Default It worked Guessed. Thank you

Hey guessed I was able to get your code to work. This has made my work far easier allowing me to delegate more time to the rest of the report. I'll try to see if I can figure out how to get the macro to cancel without waiting for it to finish, but for now I am more than pleased.
Reply With Quote
  #7  
Old 07-10-2018, 08:31 PM
Guessed's Avatar
Guessed Guessed is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

If you are using the code and the workflow is efficient enough, then it is worthwhile to come up with a solution to how the code can be prematurely terminated. Ctrl-Break would be one way but it isn't particularly elegant.

Another way would be to add a prompt for "Would you like to do another one?" but that would be an extra click which would prove more of an annoyance.

Another way would be to ask up front how many graphics you want to do or maybe limit the counter to blocks of 10?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #8  
Old 07-11-2018, 03:57 AM
Guessed's Avatar
Guessed Guessed is offline How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Windows 10 How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Yep, I had a play with it and Ctrl-Break is adequate if it is only you running it.

If you had a bunch of people using the macro then it would be worth finding a more elegant way to break the code but a single user can be trained to use the regular code interruption method.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
macro help, word 2016-64, word table

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Pictures within doc print way too small: word 2016 pamaples Word 4 08-27-2018 03:02 PM
Text prints OK, pictures print way too small: Word 2016 doc pamaples Drawing and Graphics 0 04-27-2017 09:14 AM
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Word 2016 Not Auto Aligning Pictures to Text CrossReach Word 2 01-21-2017 08:14 AM
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Word 2013 - pictures inserted into word appear in two different formats, need to change katm3 Word 4 05-22-2015 12:53 AM
How do I change multiple pictures in Word 2016 to all new pictures that appear in a specified order? Resize multiple pictures in a Word 2010 table JBA479 Word VBA 1 01-24-2014 08:51 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft