Photo Exporting Macro in Excel

nbondelli

New Member
Joined
Nov 25, 2013
Messages
1
I'm creating an expense database for real estate apartments at an appraisal company. I want to create a macro that exports a photo for each property into a word doc or pdf. Each property is a different row, and I would put the photo into the last column of each row. It's a large database and we will be filtering the information first to find relevant properties, so it needs to be dynamic as well. Is there any way to put each photo into those cells and create the ability to export it to such a document?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hello and welcome to the Board
The following example repositions a picture and exports it to Word.
Tell me what modifications are needed on this code:

Code:
Sub CreateWordTable()       ' this is an Excel macro
Dim wap As Word.Application, wdoc As Word.Document
Dim myRange As Word.Range, tbl As Word.Table
With Worksheets("Sheet1")
    .Shapes("Picture 1").Left = Range("k4").Left    ' reposition picture
    .Shapes("Picture 1").Copy
End With
Set wap = CreateObject("Word.Application")
wap.Visible = True
 
Set wdoc = wap.Documents.Add
With wdoc
    Set myRange = .Range(Start:=0, End:=0)
    Set tbl = .Tables.Add(Range:=myRange, numrows:=4, numcolumns:=3)
End With
    tbl.Rows(2).Cells(1).Range.Paste
    wdoc.SaveAs ThisWorkbook.Path & "\table1.doc"
    wap.Quit False
    Set wap = Nothing
    Set wdoc = Nothing
     
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top