T
TimTDP
I use the following code to insert a picture into Word 2000 from Access 2000:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim oShp As InlineShape
Dim shp As Shape
Set db = CurrentDb()
Set rst = db.OpenRecordset("select * from tblData")
Dim objWord As Word.Application
' Launch Word and load the invoice template
Set objWord = New Word.Application
objWord.Documents.Add "C:\CoverPage.dot"
objWord.Visible = True
' Add header information using predefined bookmarks
With objWord.ActiveDocument.Bookmarks
.Item("PreparedFor").Range.Text = rst!PreparedFor
.Item("PreparedForAddress").Range.Text = rst!PreparedForAddress
Set oShp =
..Item("GraphicFile").Range.InlineShapes.AddPicture("C:\210.jpg", False, True)
End With
With oShp
.Fill.Visible = msoFalse
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoFalse
.LockAspectRatio = msoFalse
.Height = 291.1
.Width = 387.5
.PictureFormat.Brightness = 0.5
.PictureFormat.Contrast = 0.5
.PictureFormat.ColorType = msoPictureAutomatic
.PictureFormat.CropLeft = 0#
.PictureFormat.CropRight = 0#
.PictureFormat.CropTop = 0#
.PictureFormat.CropBottom = 0#
Set shp = .ConvertToShape
With shp
.ZOrder msoSendBehindText
.WrapFormat.Type = wdWrapTight
End With
End With
Set oShp = Nothing
Set shp = Nothing
The above code inserts the picture and re-sizes it. However I am having
problems with formating the picture. I need to set the following:
Format Picture | Layout
Wrapping Style = Infront of text
Horizontal Position = Center
I have tried to set this suing the code below Set shp = .ConvertToShape but
with no luck.
What is the correct syntax?
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim oShp As InlineShape
Dim shp As Shape
Set db = CurrentDb()
Set rst = db.OpenRecordset("select * from tblData")
Dim objWord As Word.Application
' Launch Word and load the invoice template
Set objWord = New Word.Application
objWord.Documents.Add "C:\CoverPage.dot"
objWord.Visible = True
' Add header information using predefined bookmarks
With objWord.ActiveDocument.Bookmarks
.Item("PreparedFor").Range.Text = rst!PreparedFor
.Item("PreparedForAddress").Range.Text = rst!PreparedForAddress
Set oShp =
..Item("GraphicFile").Range.InlineShapes.AddPicture("C:\210.jpg", False, True)
End With
With oShp
.Fill.Visible = msoFalse
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoFalse
.LockAspectRatio = msoFalse
.Height = 291.1
.Width = 387.5
.PictureFormat.Brightness = 0.5
.PictureFormat.Contrast = 0.5
.PictureFormat.ColorType = msoPictureAutomatic
.PictureFormat.CropLeft = 0#
.PictureFormat.CropRight = 0#
.PictureFormat.CropTop = 0#
.PictureFormat.CropBottom = 0#
Set shp = .ConvertToShape
With shp
.ZOrder msoSendBehindText
.WrapFormat.Type = wdWrapTight
End With
End With
Set oShp = Nothing
Set shp = Nothing
The above code inserts the picture and re-sizes it. However I am having
problems with formating the picture. I need to set the following:
Format Picture | Layout
Wrapping Style = Infront of text
Horizontal Position = Center
I have tried to set this suing the code below Set shp = .ConvertToShape but
with no luck.
What is the correct syntax?