Link to home
Start Free TrialLog in
Avatar of Alex Campbell
Alex CampbellFlag for United States of America

asked on

Need Word Macro to Select Graphics Files and Insert Each Separated by Hard Return

I need to be able to start a macro in a new or existing document that will:
1. Allow me to go to a folder.
2. Select individual graphics files in the folder.
3. Click on OK.
4. The graphics files would then be inserted into the document:
Graphics File 1
Paragraph Mark
Graphics File 2
Paragraph Mark
Graphics File 3
Paragraph Mark
...
Last File
Paragraph Mark
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Have you tried recording one? That should get you started.
Avatar of Alex Campbell

ASKER

I recorded the following macro.

There are several limitations that I would like help fixing:
1) The folder that will be used will differ each time I use it.
2) The number of pictures chosen will vary each time I use ti.
3) The pictures come in touching other.  
    I want two or more hard returns/paragraph marks between them.
    (see Before and After Pictures below).

Sub GetPix()
'
' GetPix Macro
'
'
    Selection.InlineShapes.AddPicture FileName:="U:\Captures\11-1027-00.jpg", _
        LinkToFile:=False, SaveWithDocument:=True
    ActiveWindow.ActivePane.SmallScroll Down:=-119
End Sub

Open in new window

Before.jpg
After.jpg
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, just what I was looking for.