M
Mark
I am using WORD 97.
I am in the process of producing mail merge letters via microsoft query. On
one of these fields in the original document it has been bookmarked
When the data has been merged I need to run some code which then cross
references this bookmark and inserts various extras dependant on what has
been merged into this particular field.
Please can someone tell me how this can be done so that the following code
is called:
_______________________________________________________________
Sub DocPopulate()
Dim strDivId, Signature As String
'Divisional Identifier taken from Crime Number
strDivId = Left(ActiveDocument.Bookmarks("State").Range.Text, 2)
'File path for signatures so that Ian can update them!
Signature = "U:\WT Business Services\Force Forms\Signatures\" & strDivId &
".gif"
If strDivId = "«R" Then Exit Sub
ActiveDocument.Bookmarks("Ref").Range.Text = strDivId
Select Case strDivId
Case "AA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "BA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "CA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "DA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "EA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "FA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "GA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "HA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "IA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "JA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "KA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case Else
End Select
End Sub
_________________________________________________________________
Thanks in anticipation.
Mark
I am in the process of producing mail merge letters via microsoft query. On
one of these fields in the original document it has been bookmarked
When the data has been merged I need to run some code which then cross
references this bookmark and inserts various extras dependant on what has
been merged into this particular field.
Please can someone tell me how this can be done so that the following code
is called:
_______________________________________________________________
Sub DocPopulate()
Dim strDivId, Signature As String
'Divisional Identifier taken from Crime Number
strDivId = Left(ActiveDocument.Bookmarks("State").Range.Text, 2)
'File path for signatures so that Ian can update them!
Signature = "U:\WT Business Services\Force Forms\Signatures\" & strDivId &
".gif"
If strDivId = "«R" Then Exit Sub
ActiveDocument.Bookmarks("Ref").Range.Text = strDivId
Select Case strDivId
Case "AA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "BA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "CA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "DA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "EA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "FA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "GA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "HA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "IA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "JA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case "KA"
ActiveDocument.Shapes(1).Select
With Selection
.Text = "put something here"
End With
ActiveDocument.Shapes(2).Select
With Selection
.InlineShapes.AddPicture FileName:= _
Signature, LinkToFile:=False, SaveWithDocument:=True
End With
Case Else
End Select
End Sub
_________________________________________________________________
Thanks in anticipation.
Mark