Insert picture into Word via Access

G

Guest

Hi,

I am a new to the Access programming world and I need some help with
adding jpg's to a word document via code on a Access form.

I do a test to see if any jpg's are present in a directory, if there some
then I want to use a for,next loop to insert a page break into the word
document I have open and then insert 1 picture on that new page.

I want to use the for,next loop to do the page-break insertion and to add any
pictures since the picture numbered "PIC000001", PIC000002", etc this should
be fairly simple once I understand the insert and attach process.

Any assistance would be appreciated. The following code fragment
shows what I have in mind.

'
'add in pictures to report
intPicCount = Len(strSdrPicList) / 3
'
'see if any pictures to add to the report
If (intPicCount < 1) Then
'
'no pics to add
strSdrPicInfo = "No pictures for this report."
Debug.Print "C20- No Pics"
.ActiveDocument.Bookmarks("PicInfo").Select
.Selection.Text = strSdrPicInfo
'
Else
'
'add pics to report
strSdrPicInfo = Trim(Str(intPicCount)) & " pictures for this report."
Debug.Print "C21- Add Pics"
.ActiveDocument.Bookmarks("PicInfo").Select
.Selection.Text = strSdrPicInfo
'
For intPicValue = 1 To intPicCount
'
'insert page break

'
'insert picture

'
Next intPicValue
'
End If
 
J

John Nurick

I'd fire up Word and record a macro while inserting some pictures; then
take the code generated by the macro recorder, tidy it up and modify it
until it worked in Access.
 

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