Consulting

Results 1 to 8 of 8

Thread: Image Insertion and Auto Caption and Grouping

  1. #1
    VBAX Regular
    Joined
    Jun 2017
    Posts
    15
    Location

    Image Insertion and Auto Caption and Grouping

    I am looking for a macro, that will have the following functionality:

    Clicking on Macro:
    Open up my image folder C:\\desktop\pictures and allow me to select image
    it will size image 4" square
    Word wrap to the Right side of word document
    Automatically add a caption per the style assigned
    The biggest thing would be that it would group the caption and image automatically - so when I move the image, the caption goes with it.

    Is this possible?

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    To ensure the image & caption are grouped together, put both in a table - which can have text wrapping, if you want. For some code to get you started, see: http://www.vbaexpress.com/forum/show...l=1#post306321
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Regular
    Joined
    Jun 2017
    Posts
    15
    Location
    Thanks for this.. Very helpful. I applied the VBA below, however, it does not associate the images as figures, rather sequences. As such they cannot be cross referenced. Is there a way to assoicated as figures/captions?
    Last edited by macropod; 10-20-2017 at 08:47 PM. Reason: Deleted uncessary post of unformatted code from links.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    The code in the link applies a 'Picture' caption to every image; that is what you cross-reference. All captions use SEQ fields, regardless of whether they're for equations, figures, tables or, as in my code, pictures.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Regular
    Joined
    Jun 2017
    Posts
    15
    Location
    Thanks you for your reply. In the cross reference, there are isn't any references to the caption. I would like to reference the figure and sequence number. (I.e.; see figure 1).
    Is this possible?

  6. #6
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    You might at least look in the 'Reference Type' dropdown. There you will find 'Picture'... And, quite obviously, if that's what the captions are, you can't reference them as 'Figure'. If you want to reference the captions as figures, instead of as pictures, you will have to edit the code so it uses 'Figure' captions instead of 'Picture' captions.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  7. #7
    VBAX Regular
    Joined
    Jun 2017
    Posts
    15
    Location
    • Might you be able to help me modify the code so it uses uses 'Figure' captions instead of 'Picture' captions.


  8. #8
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    I'm sure it wouldn't take more than 30 seconds for you to find what needs changing...
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •