![]() |
|
#1
|
|||
|
|||
|
Hello, I'm looking for a macro that insert multiple pictures I've selected in an dialog into a tabel with 3 columns. Rows are automatically added based on the number of pictures. I've had a macro that works in Windows, but I can't get it to work on a Macbook. Can someone please help me? Thanks, Nina |
|
#2
|
||||
|
||||
|
A possible Word for Windows candidate is: https://www.msofficeforums.com/word-...html#post47919. I don't know whether that would work on a Mac, however.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Hello,
Thanks for the reply. I think I've used the code you are refering to on my windows pc. But it doesn't work on Mac. :-( |
|
#4
|
||||
|
||||
|
For the necessary Mac modifications, see: https://answers.microsoft.com/en-us/...2-fc62e569fe5a
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
Hello,
thank you for the link. I now get it to open the window to select the images. However I am not able to select any... The thing I want to achieve is the following: Insert multiple pictures at once. They already have the same size. But when I insert them they stick together. There should be some whitespace in between. Maybe there is an other simpler way to align them all at once? |
|
#6
|
|||
|
|||
|
I was now playing around with find-replace
The best result is when I search for ^g and replace it with ^&^t^&^t^&^p^p this is more or less the look that I want. the only problem here is that now my images are added 2 more times. When I replace by ^&^t the tab is added but the images still stick together in heigt. also starting from the second line the tab is added in the front. So not really what I want... |
|
#7
|
||||
|
||||
|
You should be able to use a wildcard Find/Replace with:
Find = (^g)(^g) Replace = \1^t\2^l^l
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#8
|
|||
|
|||
|
When I try this I get a message that ^g isn't a valid special character when using wild cards...
I tried to translate from Dutch, so I'm sorry if the words I used above aren't the correct ones. |
|
#9
|
||||
|
||||
|
Hmm, according to the Find/Replace dialogue, ^g is valid with wildcards. No matter, try two ordinary Find/Replaces, with:
Find = ^g^g Replace = ^&^l^l and: Find = ^g^l Replace = ^t^&
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#10
|
|||
|
|||
|
Hello,
Getting close! now the images are with two on a row in stead of 3. Is 3 possible? I have been playing around without any luck thanks |
|
#11
|
||||
|
||||
|
Try:
Find = ^g^g^g Replace = ^&^l^l then: Find = ^g^l Replace = ^t^& then: Find = ^g^t Replace = ^t^&
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#12
|
|||
|
|||
|
got it! THANKS!!!
what I did is: First: ^g^g^g replace by ^&^l second: ^g replace by ^&^t couldn't have done it without your help! Is there a way to put this in a macro? so the user just has to push one button? (on a mac of course) I tried to record it, but nothing got recorded. |
|
#13
|
||||
|
||||
|
Your approach will insert unnecessary tabs before the line breaks - and in some situations that could affect the overall layout.
For a macro, try: Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Text = "^g^g^g"
.Replacement.Text = "^&^l^l"
.Execute Replace:=wdReplaceAll
.Text = "^g^l"
.Replacement.Text = "^t^&"
.Execute Replace:=wdReplaceAll
.Text = "^g^t"
.Replacement.Text = "^t^&"
.Execute Replace:=wdReplaceAll
End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#14
|
|||
|
|||
|
Hello,
I used your macro and it works! :-) The only problem is that when I have a line with only 2 images, no tab is added between them. That is why I used the other code I made. |
|
#15
|
||||
|
||||
|
In that case, you could use:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Text = "^g^g^g"
.Replacement.Text = "^&^l^l"
.Execute Replace:=wdReplaceAll
.Text = "^g"
.Replacement.Text = "^&^t"
.Execute Replace:=wdReplaceAll
.Text = "^t^l"
.Replacement.Text = "^l"
.Execute Replace:=wdReplaceAll
End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Insert Pictures - Via MACRO
|
sahrens1 | Word VBA | 1 | 07-02-2017 07:16 AM |
How do I insert pictures directly into picture boxes by clicking the box instead of using INSERT>PIC
|
Bree | Word | 1 | 06-24-2016 10:32 PM |
Macro to insert multiple pictures with adjustable column size
|
nando88 | Word VBA | 6 | 05-09-2016 11:56 PM |
Insert an article with pictures into a table cell
|
skatiemcb | Word Tables | 2 | 01-24-2015 08:18 AM |
Macro to insert multiple pictures to word to a specific size and text wrap
|
mescaL | Word VBA | 3 | 11-03-2014 10:51 PM |