View Single Post
 
Old 07-27-2012, 04:53 PM
okiegirl okiegirl is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jul 2012
Posts: 4
okiegirl is on a distinguished road
Default

I finally found what works. I inserted the following into Access 2010 that will run when a command button is clicked in an Access form. The code will open the word document that I already have set up and insert the picture, resize it, and add a border around the picture.
Code:
Private Sub Command127_Click()
'generates the individual comp template for the current record
LOCAL_TEMPLATE = Me.txtCompTemplate
'SEE IF THE TEMPLATE IS OPEN
DoCmd.SetWarnings False
'THIS QUERY CREATES A TEMP TABLE FOR THE MERGE
DoCmd.OpenQuery "qryCompData", acViewNormal
Call OPEN_WORD_MERGE_DOC(LOCAL_TEMPLATE)
'This is a copy of the Word macro to bring in the picture
Dim newPicture As InlineShape
Selection.GoTo what:=wdGoToBookmark, Name:="Picture"
Set newPicture = Selection.InlineShapes.AddPicture(FileName:=Me.Photo1, _
  LinkToFile:=False, SaveWithDocument:=True)
With newPicture
  .LockAspectRatio = msoTrue
  .Height = 252
  .Width = 410.25
  With .Borders(wdBorderBottom)
    .LineStyle = wdLineStyleSingle
    .LineWidth = wdLineWidth100pt
    .Color = wdColorBlack
  End With
  With .Borders(wdBorderTop)
    .LineStyle = wdLineStyleSingle
    .LineWidth = wdLineWidth100pt
    .Color = wdColorBlack
  End With
  With .Borders(wdBorderLeft)
    .LineStyle = wdLineStyleSingle
    .LineWidth = wdLineWidth100pt
    .Color = wdColorBlack
  End With
  With .Borders(wdBorderRight)
    .LineStyle = wdLineStyleSingle
    .LineWidth = wdLineWidth100pt
    .Color = wdColorBlack
  End With
End With
End Sub

Last edited by macropod; 07-28-2012 at 01:47 AM. Reason: Added Code Tags & Formatting
Reply With Quote