You will need to modify the macro with some more specific code to handle the
graphics. There is no doubt however that it can be done. Here's a
procedure from a project that I created at one time that does that sort of
thing (it too however will need to be modifed for your situation):
Sub UpdateDocs()
myFile = Dir$(PathToUse & "*.doc")
While myFile <> ""
'Open document
Set myDoc = Documents.Open(PathToUse & myFile)
'Insert logo if the file has been selected
If InStr(txtLargeLogoPath, ":") > 0 Then
If myDoc.Sections.Count > 1 And Not myDoc.Name = "FRM-701.doc" Then
'Insert Logo on Title Page
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.Delete
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes.AddPicture Filename:=txtLargeLogoPath
' Adjust size of logo to match avalable space
oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If oheight < InchesToPoints(2) Then
With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Height = InchesToPoints(2)
.Width = owidth * InchesToPoints(2) / oheight
End With
End If
oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If owidth > InchesToPoints(2.85) Then
With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Width = InchesToPoints(2.85)
.Height = oheight * InchesToPoints(2.85) / owidth
End With
End If
'Insert Logo into all the Headers in the Document
For i = 2 To myDoc.Sections.Count
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.Delete
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes.AddPicture Filename:=txtLargeLogoPath
'Re-size logo
oheight =
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If oheight > InchesToPoints(0.68) Then
With
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Height = InchesToPoints(0.68)
.Width = owidth * InchesToPoints(0.68) / oheight
End With
End If
If oheight < InchesToPoints(0.68) Then
With
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Height = InchesToPoints(0.68)
.Width = owidth * InchesToPoints(0.68) / oheight
End With
End If
oheight =
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If owidth > InchesToPoints(0.98) Then
With
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Width = InchesToPoints(0.98)
.Height = oheight * InchesToPoints(0.98) / owidth
End With
End If
Next i
Else
'Insert Logo into Section 1 Header
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.Delete
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes.AddPicture Filename:=txtLargeLogoPath
'Re-size logo
oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If oheight > InchesToPoints(0.68) Then
With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Height = InchesToPoints(0.68)
.Width = owidth * InchesToPoints(0.68) / oheight
End With
End If
If UCase(myDoc.Name) = "FRM-701.DOC" Then 'Special Case
document
'Insert Logo into Section 2 Header
myDoc.Sections(2).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.Delete
myDoc.Sections(2).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes.AddPicture Filename:=txtLargeLogoPath
'Re-size logo
oheight =
myDoc.Sections(2).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(2).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If oheight > InchesToPoints(0.68) Then
With
myDoc.Sections(2).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Height = InchesToPoints(0.68)
.Width = owidth * InchesToPoints(0.68) / oheight
End With
End If
End If
End If
End If
'Create Document Variables
myDoc.Variables("vissue").Value = 1
myDoc.Variables("vrevision").Value = 0
myDoc.Variables("vDocDate").Value = Format(vIssueDate, "MMMM dd, yyyy")
myDoc.Variables("vRevDate").Value = Format(vIssueDate, "MMM dd, yyyy")
myDoc.Variables("vreviewer").Value = txtReviewer
myDoc.Variables("vapprover").Value = txtApprover
myDoc.Variables("vcompanyname").Value = txtCompanyName
myDoc.Variables("vstreetaddress").Value = txtStreetAddress
myDoc.Variables("vcity").Value = txtCity
myDoc.Variables("vstateprovince").Value = comboProvinceorState.Value
myDoc.Variables("vcountry").Value = comboCountry.Value
myDoc.Variables("vpostcodezip").Value = txtPostalorZipCode
myDoc.Variables("vqualityreptitle").Value = txtQualityRepTitle
myDoc.Variables("vphone").Value = txtPhone
myDoc.Variables("vfax").Value = txtFax
myDoc.Variables("vmanagername").Value = txtSeniorManagerName
myDoc.Variables("vmanagertitle").Value = txtSeniorManagerTitle
myDoc.Variables("vqualityrepname").Value = txtQualityRepName
'Update the fields in the document to display the values inserted into the
variables
myDoc.Fields.Update
For i = 1 To myDoc.Sections.Count
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).Range.Fields.Update
Next i
'Save and Close
myDoc.Close SaveChanges:=wdSaveChanges
'Next file in folder
myFile = Dir$()
Wend
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP