#1
|
|||
|
|||
Modifying Macropod's Macro (Insert Multiple Images with Caption)
I have no business playing messing around with macros but I'm trying to make my work life a bit easier so here goes.
I used Macropod's code from this sticky: https://www.msofficeforums.com/drawi...-document.html I changed it up so that the inserted photos are of certain dimension and whatnot. I got a couple of questions on how to change parts of the macro so that: 1) The caption cells will always have a shading of "White, Background 1, Darker 25%" 2) The caption template will always be: Figure (numeric value) Comment: 3) The caption font will always be Black, Times New Roman, Font 12 4) The caption [paragraph] will have 0 pt for before and after spacing and single line spacing 5) The macro table (the image and its caption) will always be horizontally centered to the entire page. Vertically centered would be a bonus but my work documents have header/footer information which I currently do not have the dimensions to right now. The bolds above are priority. I've also attached an example of what I'm looking for. For caption 2, I was able to extend the height of the caption so that the words don't get cut off when I write a full sentence, but I cannot extend the height of the caption for caption 1 (due to inserted photo constraints?). I would like the height of the caption to be like caption 2 and not caption 1. This template is based on Macropod's Macro mixed with my memory of what my work's template looks like. I'll have to go into the office tomorrow and see the official template but I might be content with a Modified Macropod Macro. |
#2
|
|||||
|
|||||
Quote:
Code:
.Cells.Shading.BackgroundPatternColor = -603930625 Quote:
Code:
CaptionLabels.Add Name:="Picture" Code:
.Characters.First.InsertCaption _ Label:="Figure", Title:=StrTxt, _ Quote:
Quote:
Code:
.Rows.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage .Rows.HorizontalPosition = wdTableCenter .Rows.RelativeVerticalPosition = wdRelativeVerticalPositionPage .Rows.VerticalPosition = wdTableCenter Quote:
|
#3
|
|||
|
|||
Thanks for your reply, Italophile!
So I was able 1) Change the caption cell color 5) Macro aligned horizontally and vertically centered 6) Change the Caption Height As for the labels and whatnot inside the gray caption cell, mine comes out as attached. How do I go from "Figure 1Comment:" to "Figure 1 Comment: " (basically putting the "Comment: " line under the "Figure" line). My macro line for that is currently set up as: Label:="Figure", Title:="Comment: ", _ Also when you mentioned for the font style "Simply modify the Caption style in the template you use for this document.", it went completely over my head I know it seems very elementary but this is coming from someone with absolutely 0 background on these things! |
#4
|
|||
|
|||
Quote:
Code:
Label:="Figure", Title:=vbCr & "Comment: " Quote:
|
#5
|
|||
|
|||
Quote:
Without a sound basic understanding of how Word is working, under the hood, writing or modifying macros is going to be extremely frustrating. Just trying to use Word to do anything other than type a basic letter or note is going to be challenging. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to insert multiple images into a table with defined number of rows and columns | Davidl88 | Word VBA | 6 | 09-05-2022 03:41 PM |
Need Help modifying code for inserting multiple images | atifsyed | Word VBA | 8 | 05-17-2022 07:31 PM |
Macro to insert multiple images into a table | Penini | Word VBA | 1 | 03-23-2022 02:30 PM |
Insert multiple images at once from a folder | beyondimage | Excel | 1 | 02-01-2017 12:58 AM |