Photo Book Ideas?

I

Ian

I use Publisher 2007 to produce photo books. This essentially involves
taking a large number of picture files, putting them all into a book format
using a limited number of pre-defined formats and then producing a pdf file
for uploading. I found that this could be a tedious, time-consuming process
and therefore decided to write some macros to automate the process as much as
possible. What might have taken hours can now be done in a few seconds.

The following code, for example, allows the user to select multiple picture
files (perhaps all those in a particular folder) using a standard Windows
dialog box and to write the results into a text file for subsequent
processing.

Dim myFile As String
Dim Exists As Boolean
Dim Choice As Integer
Dim fs As Object, f As Object
Dim fd As FileDialog
Dim myItem As Variant

myFile = "C:\Users\Ian\Pictures\Create_Book\PictureList.txt"
Exists = IIf(Len(Dir(myFile)) > 0, True, False)
Choice = vbYes
If Exists Then
Choice = MsgBox("A PictureList file already exists. Do you want to
overwrite it?" _
& Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
"(Current selections will otherwise be appended to the existing
file.)", vbYesNo, _
"Overwrite or append?")
If Choice = vbYes Then
Kill myFile
End If
End If
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(myFile, IIf(Choice = vbYes, 2, 8), True)
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.Filters.Clear
fd.Filters.Add "Pictures", "*.jpg", 1
If fd.Show = -1 Then
For Each myItem In fd.SelectedItems
f.WriteLine myItem
Next
End If
f.Close
Set fd = Nothing
MsgBox "Done."

Anybody interested in discussing?
 
P

psvogt

I've never attempted macros- but I am interested in what you are doing.
In my application, I would be adding just one photo to 300 or so half-page
flyers. Different photos for each flyer. How does your macro know which
photo to place where?
psvogt
 
I

Ian

You would want the picture files, as listed within the text file, to be in
the same order as they are to be used. This could be done in a number of
ways.

1) You could rename the picture files to reflect the desired order (e.g.
001, 002, etc.) and then simply select the pictures as one large group.

2) You could select and write the picture files into the text file in the
desired order. This would be tedious on a one-by-one basis but could work
well if you have only a few large blocks of pictures.

3) You could edit the text file.
 
P

psvogt

Thanks for the tips.
I'm not sure that would actually save any time, but I'll look into it!
 
I

Ian

The payoff, if any, would be dependent upon how you might envision being able
to use the text file.

I image that, in your case, you might want to set up a one page publication
with two flyers on it and with placeholders for the pictures. A loop in a
second macro could then replace the top picture, replace the bottom picture,
and then print the page. The loop would repeat these steps 150 times or so
until the macro reached the end of the text file.

If the ordering of the flyers is of importance and if you have to start out
with a set of pictures in no particular order, then I would be inclined to
paste the unsorted text file into a spreadsheet and then, in a separate
column, number them however you might want, sort the list by this number and
paste the file names back into the text file. One way or the other, you
would have to go through some manual process.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top