![]() |
|
#1
|
|||
|
|||
|
I'm looking to make a macro that will do the following:
1. Insert all selected photos from a specified folder into the word document. 2. Wrap text square for all images. 3. Format the images, 6 to a page like in the image below: ![]() I did some digging on the web and found the following macro that inserts all selected images into the word document: Code:
Sub InsertImages()
Dim doc As Word.Document
Dim fd As FileDialog
Dim vItem As Variant
Dim mg1 As Range
Dim mg2 As Range
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Set doc = ActiveDocument
With fd
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
.FilterIndex = 1
If .Show = -1 Then
For Each vItem In .SelectedItems
Set mg2 = ActiveDocument.Range
mg2.Collapse wdCollapseEnd
doc.InlineShapes.AddPicture _
FileName:=vItem, _
LinkToFile:=False, SaveWithDocument:=True, Range:=mg2
Set mg1 = ActiveDocument.Range
mg1.Collapse wdCollapseEnd
mg1.Text = vbCrLF & vbCrLf
Next vItem
End If
End With
Set fd = Nothing
End Sub
|
|
#2
|
||||
|
||||
|
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
||||
|
||||
|
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Major problems inserted images into Word
|
EsoxL | Word | 4 | 01-30-2015 06:48 PM |
Generally disable alt text for images inserted into a .docx
|
Lebber | Word | 2 | 01-24-2013 11:25 AM |
Inserted images constantly SHIFTING in text! Why?!!!!
|
corrinnecareens | Drawing and Graphics | 1 | 04-08-2012 11:32 PM |
Inserted images don't appear
|
terence_laoshi | Drawing and Graphics | 2 | 04-14-2011 05:08 AM |
Why are images so big when inserted into Word?
|
WaltR | Word | 2 | 02-13-2011 10:43 PM |