Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-23-2017, 08:15 PM
rms42 rms42 is offline Formatting Inserted Images (6 to a page) Windows 8 Formatting Inserted Images (6 to a page) Office 2013
Novice
Formatting Inserted Images (6 to a page)
 
Join Date: Apr 2017
Posts: 1
rms42 is on a distinguished road
Default Formatting Inserted Images (6 to a page)

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
Any help is appreciated. Thanks!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Inserted Images (6 to a page) Major problems inserted images into Word EsoxL Word 4 01-30-2015 06:48 PM
Formatting Inserted Images (6 to a page) Generally disable alt text for images inserted into a .docx Lebber Word 2 01-24-2013 11:25 AM
Formatting Inserted Images (6 to a page) Inserted images constantly SHIFTING in text! Why?!!!! corrinnecareens Drawing and Graphics 1 04-08-2012 11:32 PM
Formatting Inserted Images (6 to a page) Inserted images don't appear terence_laoshi Drawing and Graphics 2 04-14-2011 05:08 AM
Formatting Inserted Images (6 to a page) Why are images so big when inserted into Word? WaltR Word 2 02-13-2011 10:43 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:33 AM.


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