I have a dll which does some mailmerge for me, the dll is called from VB6.
It work fine with word 2002 but it fails in this routine I have here below.
The line that fails is
Kill mdataDocNavn, it deletes the temp file created. but it does not fail on
first run but from secund run and more, I found that the line
.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges on first run closes
the tempfile created by the OpenDataSource function, but only on first run,
so later when I try to delete my tempfile it is open and I cannot access it,
it is open but not in the Documents collection, so what do I do?


Public Sub MergeAndPrint(Optional VisWord As Variant)
Dim i As Integer
Dim i2 As Integer
Dim VisDokument As Boolean
Dim boolFillInFelter As Boolean
Dim testField As Word.Field

On Error GoTo errorrut:

If Not IsMissing(VisWord) Then
VisDokument = CBool(VisWord)
Else
VisDokument = True
End If

With WordObj

.ActiveDocument.SaveAs FileName:=mDataDocNavn, FILEFormat:=0,
LOCKCOMMENTS:=False, Password:="", ADDTORECENTFILES:=False,
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=0,
SAVENATIVEPICTUREFORMAT:=0, SaveFormsData:=0
.ActiveDocument.Close
.Windows(masterdok).Activate
'Indsat 9-10-2002 for at løse problemet med manglende menu
funktioner
'hvis der findes Fill-In felter i dokumentet
boolFillInFelter = False
For Each testField In .ActiveDocument.Fields
If InStr(testField.Code, "FILLIN") Then
boolFillInFelter = True
Exit For
End If
Next testField
'*************************************************************
.ActiveDocument.MailMerge.MainDocumentType = 0
With .Selection.Find
.ClearFormatting
.Text = "\* FLETFORMAT"
.Replacement.Text = "\* MERGEFORMAT"
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll
End With

If NormalFeltCollection.Count > 0 Or ListPackCollection.Count > 0
Then
.ActiveDocument.MailMerge.OpenDataSource Name:=mDataDocNavn,
ConfirmConversions:=0, ReadOnly:=0, LINKTOSOURCE:=1, ADDTORECENTFILES:=0,
PASSWORDDOCUMENT:="", PASSWORDTEMPLATE:="", Revert:=0,
WRITEPASSWORDDOCUMENT:="", WRITEPASSWORDTEMPLATE:="", Connection:="",
SQLSTATEMENT:="", SQLSTATEMENT1:=""
.ActiveDocument.MailMerge.Destination = wdSendToNewDocument

<SOME CODE>

.ActiveDocument.MailMerge.Execute

<SOME CODE>

'**********************************************************
End If

.Windows(masterdok).Activate
.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
End With

If NormalFeltCollection.Count > 0 Or ListPackCollection.Count > 0 Then
<Lots of replacements>
For i = 1 To WordObj.ActiveDocument.Sections.Count
For i2 = 1 To WordObj.ActiveDocument.Sections(i).Headers.Count
With
WordObj.ActiveDocument.Sections(i).Headers(i2).Range.Fields
.Update
End With
Next i2
For i2 = 1 To WordObj.ActiveDocument.Sections(i).Footers.Count
With
WordObj.ActiveDocument.Sections(i).Footers(i2).Range.Fields
.Update
End With
Next i2

Next i
WordObj.ActiveWindow.View.ShowFieldCodes = False
End If

Kill mDataDocNavn
If VisDokument Then
WordObj.Visible = True
End If
Exit Sub
errorrut:
MsgBox (Err.Description)
'Resume
If Errors.Count > 1 Then
For i = 0 To Errors.Count - 1
MsgBox (Errors(i).Description)
Next
End If
End Sub

Re: Mailmerge error? by JGM

JGM
Thu Dec 11 07:49:02 CST 2003

Hi Betina,

See the KB article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;189618

It may relate to your situation.

Cheers!
--
_______________________________________
Jean-Guy Marcil
jmarcil@sympatico.ca

"Betina Y Andersen" <byl@fjernegdatainformmigherfra.dk> a écrit dans le
message de news: #Yj8id#vDHA.560@TK2MSFTNGP11.phx.gbl...
> I have a dll which does some mailmerge for me, the dll is called from VB6.
> It work fine with word 2002 but it fails in this routine I have here
below.
> The line that fails is
> Kill mdataDocNavn, it deletes the temp file created. but it does not fail
on
> first run but from secund run and more, I found that the line
> .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges on first run closes
> the tempfile created by the OpenDataSource function, but only on first
run,
> so later when I try to delete my tempfile it is open and I cannot access
it,
> it is open but not in the Documents collection, so what do I do?
>
>
> Public Sub MergeAndPrint(Optional VisWord As Variant)
> Dim i As Integer
> Dim i2 As Integer
> Dim VisDokument As Boolean
> Dim boolFillInFelter As Boolean
> Dim testField As Word.Field
>
> On Error GoTo errorrut:
>
> If Not IsMissing(VisWord) Then
> VisDokument = CBool(VisWord)
> Else
> VisDokument = True
> End If
>
> With WordObj
>
> .ActiveDocument.SaveAs FileName:=mDataDocNavn, FILEFormat:=0,
> LOCKCOMMENTS:=False, Password:="", ADDTORECENTFILES:=False,
> WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=0,
> SAVENATIVEPICTUREFORMAT:=0, SaveFormsData:=0
> .ActiveDocument.Close
> .Windows(masterdok).Activate
> 'Indsat 9-10-2002 for at løse problemet med manglende menu
> funktioner
> 'hvis der findes Fill-In felter i dokumentet
> boolFillInFelter = False
> For Each testField In .ActiveDocument.Fields
> If InStr(testField.Code, "FILLIN") Then
> boolFillInFelter = True
> Exit For
> End If
> Next testField
> '*************************************************************
> .ActiveDocument.MailMerge.MainDocumentType = 0
> With .Selection.Find
> .ClearFormatting
> .Text = "\* FLETFORMAT"
> .Replacement.Text = "\* MERGEFORMAT"
> .Replacement.ClearFormatting
> .Execute Replace:=wdReplaceAll
> End With
>
> If NormalFeltCollection.Count > 0 Or ListPackCollection.Count > 0
> Then
> .ActiveDocument.MailMerge.OpenDataSource Name:=mDataDocNavn,
> ConfirmConversions:=0, ReadOnly:=0, LINKTOSOURCE:=1, ADDTORECENTFILES:=0,
> PASSWORDDOCUMENT:="", PASSWORDTEMPLATE:="", Revert:=0,
> WRITEPASSWORDDOCUMENT:="", WRITEPASSWORDTEMPLATE:="", Connection:="",
> SQLSTATEMENT:="", SQLSTATEMENT1:=""
> .ActiveDocument.MailMerge.Destination = wdSendToNewDocument
>
> <SOME CODE>
>
> .ActiveDocument.MailMerge.Execute
>
> <SOME CODE>
>
> '**********************************************************
> End If
>
> .Windows(masterdok).Activate
> .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> End With
>
> If NormalFeltCollection.Count > 0 Or ListPackCollection.Count > 0 Then
> <Lots of replacements>
> For i = 1 To WordObj.ActiveDocument.Sections.Count
> For i2 = 1 To WordObj.ActiveDocument.Sections(i).Headers.Count
> With
> WordObj.ActiveDocument.Sections(i).Headers(i2).Range.Fields
> .Update
> End With
> Next i2
> For i2 = 1 To WordObj.ActiveDocument.Sections(i).Footers.Count
> With
> WordObj.ActiveDocument.Sections(i).Footers(i2).Range.Fields
> .Update
> End With
> Next i2
>
> Next i
> WordObj.ActiveWindow.View.ShowFieldCodes = False
> End If
>
> Kill mDataDocNavn
> If VisDokument Then
> WordObj.Visible = True
> End If
> Exit Sub
> errorrut:
> MsgBox (Err.Description)
> 'Resume
> If Errors.Count > 1 Then
> For i = 0 To Errors.Count - 1
> MsgBox (Errors(i).Description)
> Next
> End If
> End Sub
>
>



Re: Mailmerge error? by Betina

Betina
Fri Dec 12 01:29:56 CST 2003

I am sorry but that does not help me :-(

\Betina

"JGM" <no-spam@leaveme.alone> skrev i en meddelelse
news:#G$Fny#vDHA.2316@TK2MSFTNGP10.phx.gbl...
> Hi Betina,
>
> See the KB article:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;189618
>
> It may relate to your situation.
>
> Cheers!
> --
> _______________________________________
> Jean-Guy Marcil
> jmarcil@sympatico.ca
>
> "Betina Y Andersen" <byl@fjernegdatainformmigherfra.dk> a écrit dans le
> message de news: #Yj8id#vDHA.560@TK2MSFTNGP11.phx.gbl...
> > I have a dll which does some mailmerge for me, the dll is called from
VB6.
> > It work fine with word 2002 but it fails in this routine I have here
> below.
> > The line that fails is
> > Kill mdataDocNavn, it deletes the temp file created. but it does not
fail
> on
> > first run but from secund run and more, I found that the line
> > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges on first run
closes
> > the tempfile created by the OpenDataSource function, but only on first
> run,
> > so later when I try to delete my tempfile it is open and I cannot access
> it,
> > it is open but not in the Documents collection, so what do I do?
> >
> >
> > Public Sub MergeAndPrint(Optional VisWord As Variant)
> > Dim i As Integer
> > Dim i2 As Integer
> > Dim VisDokument As Boolean
> > Dim boolFillInFelter As Boolean
> > Dim testField As Word.Field
> >
> > On Error GoTo errorrut:
> >
> > If Not IsMissing(VisWord) Then
> > VisDokument = CBool(VisWord)
> > Else
> > VisDokument = True
> > End If
> >
> > With WordObj
> >
> > .ActiveDocument.SaveAs FileName:=mDataDocNavn, FILEFormat:=0,
> > LOCKCOMMENTS:=False, Password:="", ADDTORECENTFILES:=False,
> > WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=0,
> > SAVENATIVEPICTUREFORMAT:=0, SaveFormsData:=0
> > .ActiveDocument.Close
> > .Windows(masterdok).Activate
> > 'Indsat 9-10-2002 for at løse problemet med manglende menu
> > funktioner
> > 'hvis der findes Fill-In felter i dokumentet
> > boolFillInFelter = False
> > For Each testField In .ActiveDocument.Fields
> > If InStr(testField.Code, "FILLIN") Then
> > boolFillInFelter = True
> > Exit For
> > End If
> > Next testField
> > '*************************************************************
> > .ActiveDocument.MailMerge.MainDocumentType = 0
> > With .Selection.Find
> > .ClearFormatting
> > .Text = "\* FLETFORMAT"
> > .Replacement.Text = "\* MERGEFORMAT"
> > .Replacement.ClearFormatting
> > .Execute Replace:=wdReplaceAll
> > End With
> >
> > If NormalFeltCollection.Count > 0 Or ListPackCollection.Count >
0
> > Then
> > .ActiveDocument.MailMerge.OpenDataSource Name:=mDataDocNavn,
> > ConfirmConversions:=0, ReadOnly:=0, LINKTOSOURCE:=1,
ADDTORECENTFILES:=0,
> > PASSWORDDOCUMENT:="", PASSWORDTEMPLATE:="", Revert:=0,
> > WRITEPASSWORDDOCUMENT:="", WRITEPASSWORDTEMPLATE:="", Connection:="",
> > SQLSTATEMENT:="", SQLSTATEMENT1:=""
> > .ActiveDocument.MailMerge.Destination = wdSendToNewDocument
> >
> > <SOME CODE>
> >
> > .ActiveDocument.MailMerge.Execute
> >
> > <SOME CODE>
> >
> > '**********************************************************
> > End If
> >
> > .Windows(masterdok).Activate
> > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> > End With
> >
> > If NormalFeltCollection.Count > 0 Or ListPackCollection.Count > 0
Then
> > <Lots of replacements>
> > For i = 1 To WordObj.ActiveDocument.Sections.Count
> > For i2 = 1 To
WordObj.ActiveDocument.Sections(i).Headers.Count
> > With
> > WordObj.ActiveDocument.Sections(i).Headers(i2).Range.Fields
> > .Update
> > End With
> > Next i2
> > For i2 = 1 To
WordObj.ActiveDocument.Sections(i).Footers.Count
> > With
> > WordObj.ActiveDocument.Sections(i).Footers(i2).Range.Fields
> > .Update
> > End With
> > Next i2
> >
> > Next i
> > WordObj.ActiveWindow.View.ShowFieldCodes = False
> > End If
> >
> > Kill mDataDocNavn
> > If VisDokument Then
> > WordObj.Visible = True
> > End If
> > Exit Sub
> > errorrut:
> > MsgBox (Err.Description)
> > 'Resume
> > If Errors.Count > 1 Then
> > For i = 0 To Errors.Count - 1
> > MsgBox (Errors(i).Description)
> > Next
> > End If
> > End Sub
> >
> >
>
>



Re: Mailmerge error? by JGM

JGM
Fri Dec 12 07:29:08 CST 2003

Hi Betina,

Have you tried replacing:
> > > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
by
.ActiveDocument.Close SaveChanges:=WordObj.wdDoNotSaveChanges
?
(You said that was the line creating the problem, right?)
Just curoius...

--
_______________________________________
Jean-Guy Marcil
jmarcil@sympatico.ca

"Betina Y Andersen" <byl@fjernegdatainformmigherfra.dk> a écrit dans le
message de news: OKnHhGIwDHA.2880@tk2msftngp13.phx.gbl...
> I am sorry but that does not help me :-(
>
> \Betina
>
> "JGM" <no-spam@leaveme.alone> skrev i en meddelelse
> news:#G$Fny#vDHA.2316@TK2MSFTNGP10.phx.gbl...
> > Hi Betina,
> >
> > See the KB article:
> > http://support.microsoft.com/default.aspx?scid=kb;en-us;189618
> >
> > It may relate to your situation.
> >
> > Cheers!
> > --
> > _______________________________________
> > Jean-Guy Marcil
> > jmarcil@sympatico.ca
> >
> > "Betina Y Andersen" <byl@fjernegdatainformmigherfra.dk> a écrit dans le
> > message de news: #Yj8id#vDHA.560@TK2MSFTNGP11.phx.gbl...
> > > I have a dll which does some mailmerge for me, the dll is called from
> VB6.
> > > It work fine with word 2002 but it fails in this routine I have here
> > below.
> > > The line that fails is
> > > Kill mdataDocNavn, it deletes the temp file created. but it does not
> fail
> > on
> > > first run but from secund run and more, I found that the line
> > > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges on first run
> closes
> > > the tempfile created by the OpenDataSource function, but only on first
> > run,
> > > so later when I try to delete my tempfile it is open and I cannot
access
> > it,
> > > it is open but not in the Documents collection, so what do I do?
> > >
> > >
> > > Public Sub MergeAndPrint(Optional VisWord As Variant)
> > > Dim i As Integer
> > > Dim i2 As Integer
> > > Dim VisDokument As Boolean
> > > Dim boolFillInFelter As Boolean
> > > Dim testField As Word.Field
> > >
> > > On Error GoTo errorrut:
> > >
> > > If Not IsMissing(VisWord) Then
> > > VisDokument = CBool(VisWord)
> > > Else
> > > VisDokument = True
> > > End If
> > >
> > > With WordObj
> > >
> > > .ActiveDocument.SaveAs FileName:=mDataDocNavn, FILEFormat:=0,
> > > LOCKCOMMENTS:=False, Password:="", ADDTORECENTFILES:=False,
> > > WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=0,
> > > SAVENATIVEPICTUREFORMAT:=0, SaveFormsData:=0
> > > .ActiveDocument.Close
> > > .Windows(masterdok).Activate
> > > 'Indsat 9-10-2002 for at løse problemet med manglende menu
> > > funktioner
> > > 'hvis der findes Fill-In felter i dokumentet
> > > boolFillInFelter = False
> > > For Each testField In .ActiveDocument.Fields
> > > If InStr(testField.Code, "FILLIN") Then
> > > boolFillInFelter = True
> > > Exit For
> > > End If
> > > Next testField
> > > '*************************************************************
> > > .ActiveDocument.MailMerge.MainDocumentType = 0
> > > With .Selection.Find
> > > .ClearFormatting
> > > .Text = "\* FLETFORMAT"
> > > .Replacement.Text = "\* MERGEFORMAT"
> > > .Replacement.ClearFormatting
> > > .Execute Replace:=wdReplaceAll
> > > End With
> > >
> > > If NormalFeltCollection.Count > 0 Or ListPackCollection.Count
>
> 0
> > > Then
> > > .ActiveDocument.MailMerge.OpenDataSource
Name:=mDataDocNavn,
> > > ConfirmConversions:=0, ReadOnly:=0, LINKTOSOURCE:=1,
> ADDTORECENTFILES:=0,
> > > PASSWORDDOCUMENT:="", PASSWORDTEMPLATE:="", Revert:=0,
> > > WRITEPASSWORDDOCUMENT:="", WRITEPASSWORDTEMPLATE:="", Connection:="",
> > > SQLSTATEMENT:="", SQLSTATEMENT1:=""
> > > .ActiveDocument.MailMerge.Destination =
wdSendToNewDocument
> > >
> > > <SOME CODE>
> > >
> > > .ActiveDocument.MailMerge.Execute
> > >
> > > <SOME CODE>
> > >
> > >
'**********************************************************
> > > End If
> > >
> > > .Windows(masterdok).Activate
> > > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> > > End With
> > >
> > > If NormalFeltCollection.Count > 0 Or ListPackCollection.Count > 0
> Then
> > > <Lots of replacements>
> > > For i = 1 To WordObj.ActiveDocument.Sections.Count
> > > For i2 = 1 To
> WordObj.ActiveDocument.Sections(i).Headers.Count
> > > With
> > > WordObj.ActiveDocument.Sections(i).Headers(i2).Range.Fields
> > > .Update
> > > End With
> > > Next i2
> > > For i2 = 1 To
> WordObj.ActiveDocument.Sections(i).Footers.Count
> > > With
> > > WordObj.ActiveDocument.Sections(i).Footers(i2).Range.Fields
> > > .Update
> > > End With
> > > Next i2
> > >
> > > Next i
> > > WordObj.ActiveWindow.View.ShowFieldCodes = False
> > > End If
> > >
> > > Kill mDataDocNavn
> > > If VisDokument Then
> > > WordObj.Visible = True
> > > End If
> > > Exit Sub
> > > errorrut:
> > > MsgBox (Err.Description)
> > > 'Resume
> > > If Errors.Count > 1 Then
> > > For i = 0 To Errors.Count - 1
> > > MsgBox (Errors(i).Description)
> > > Next
> > > End If
> > > End Sub
> > >
> > >
> >
> >
>
>



Re: Mailmerge error? by Betina

Betina
Mon Dec 15 02:41:28 CST 2003

I have tried that now but it is still the same.

Regards Betina

"JGM" <no-spam@leaveme.alone> skrev i en meddelelse
news:#2IOFMLwDHA.2540@TK2MSFTNGP09.phx.gbl...
> Hi Betina,
>
> Have you tried replacing:
> > > > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> by
> .ActiveDocument.Close SaveChanges:=WordObj.wdDoNotSaveChanges
> ?
> (You said that was the line creating the problem, right?)
> Just curoius...
>
> --
> _______________________________________
> Jean-Guy Marcil
> jmarcil@sympatico.ca
>
> "Betina Y Andersen" <byl@fjernegdatainformmigherfra.dk> a écrit dans le
> message de news: OKnHhGIwDHA.2880@tk2msftngp13.phx.gbl...
> > I am sorry but that does not help me :-(
> >
> > \Betina
> >
> > "JGM" <no-spam@leaveme.alone> skrev i en meddelelse
> > news:#G$Fny#vDHA.2316@TK2MSFTNGP10.phx.gbl...
> > > Hi Betina,
> > >
> > > See the KB article:
> > > http://support.microsoft.com/default.aspx?scid=kb;en-us;189618
> > >
> > > It may relate to your situation.
> > >
> > > Cheers!
> > > --
> > > _______________________________________
> > > Jean-Guy Marcil
> > > jmarcil@sympatico.ca
> > >
> > > "Betina Y Andersen" <byl@fjernegdatainformmigherfra.dk> a écrit dans
le
> > > message de news: #Yj8id#vDHA.560@TK2MSFTNGP11.phx.gbl...
> > > > I have a dll which does some mailmerge for me, the dll is called
from
> > VB6.
> > > > It work fine with word 2002 but it fails in this routine I have here
> > > below.
> > > > The line that fails is
> > > > Kill mdataDocNavn, it deletes the temp file created. but it does not
> > fail
> > > on
> > > > first run but from secund run and more, I found that the line
> > > > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges on first run
> > closes
> > > > the tempfile created by the OpenDataSource function, but only on
first
> > > run,
> > > > so later when I try to delete my tempfile it is open and I cannot
> access
> > > it,
> > > > it is open but not in the Documents collection, so what do I do?
> > > >
> > > >
> > > > Public Sub MergeAndPrint(Optional VisWord As Variant)
> > > > Dim i As Integer
> > > > Dim i2 As Integer
> > > > Dim VisDokument As Boolean
> > > > Dim boolFillInFelter As Boolean
> > > > Dim testField As Word.Field
> > > >
> > > > On Error GoTo errorrut:
> > > >
> > > > If Not IsMissing(VisWord) Then
> > > > VisDokument = CBool(VisWord)
> > > > Else
> > > > VisDokument = True
> > > > End If
> > > >
> > > > With WordObj
> > > >
> > > > .ActiveDocument.SaveAs FileName:=mDataDocNavn,
FILEFormat:=0,
> > > > LOCKCOMMENTS:=False, Password:="", ADDTORECENTFILES:=False,
> > > > WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=0,
> > > > SAVENATIVEPICTUREFORMAT:=0, SaveFormsData:=0
> > > > .ActiveDocument.Close
> > > > .Windows(masterdok).Activate
> > > > 'Indsat 9-10-2002 for at løse problemet med manglende menu
> > > > funktioner
> > > > 'hvis der findes Fill-In felter i dokumentet
> > > > boolFillInFelter = False
> > > > For Each testField In .ActiveDocument.Fields
> > > > If InStr(testField.Code, "FILLIN") Then
> > > > boolFillInFelter = True
> > > > Exit For
> > > > End If
> > > > Next testField
> > > >
'*************************************************************
> > > > .ActiveDocument.MailMerge.MainDocumentType = 0
> > > > With .Selection.Find
> > > > .ClearFormatting
> > > > .Text = "\* FLETFORMAT"
> > > > .Replacement.Text = "\* MERGEFORMAT"
> > > > .Replacement.ClearFormatting
> > > > .Execute Replace:=wdReplaceAll
> > > > End With
> > > >
> > > > If NormalFeltCollection.Count > 0 Or
ListPackCollection.Count
> >
> > 0
> > > > Then
> > > > .ActiveDocument.MailMerge.OpenDataSource
> Name:=mDataDocNavn,
> > > > ConfirmConversions:=0, ReadOnly:=0, LINKTOSOURCE:=1,
> > ADDTORECENTFILES:=0,
> > > > PASSWORDDOCUMENT:="", PASSWORDTEMPLATE:="", Revert:=0,
> > > > WRITEPASSWORDDOCUMENT:="", WRITEPASSWORDTEMPLATE:="",
Connection:="",
> > > > SQLSTATEMENT:="", SQLSTATEMENT1:=""
> > > > .ActiveDocument.MailMerge.Destination =
> wdSendToNewDocument
> > > >
> > > > <SOME CODE>
> > > >
> > > > .ActiveDocument.MailMerge.Execute
> > > >
> > > > <SOME CODE>
> > > >
> > > >
> '**********************************************************
> > > > End If
> > > >
> > > > .Windows(masterdok).Activate
> > > > .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> > > > End With
> > > >
> > > > If NormalFeltCollection.Count > 0 Or ListPackCollection.Count >
0
> > Then
> > > > <Lots of replacements>
> > > > For i = 1 To WordObj.ActiveDocument.Sections.Count
> > > > For i2 = 1 To
> > WordObj.ActiveDocument.Sections(i).Headers.Count
> > > > With
> > > > WordObj.ActiveDocument.Sections(i).Headers(i2).Range.Fields
> > > > .Update
> > > > End With
> > > > Next i2
> > > > For i2 = 1 To
> > WordObj.ActiveDocument.Sections(i).Footers.Count
> > > > With
> > > > WordObj.ActiveDocument.Sections(i).Footers(i2).Range.Fields
> > > > .Update
> > > > End With
> > > > Next i2
> > > >
> > > > Next i
> > > > WordObj.ActiveWindow.View.ShowFieldCodes = False
> > > > End If
> > > >
> > > > Kill mDataDocNavn
> > > > If VisDokument Then
> > > > WordObj.Visible = True
> > > > End If
> > > > Exit Sub
> > > > errorrut:
> > > > MsgBox (Err.Description)
> > > > 'Resume
> > > > If Errors.Count > 1 Then
> > > > For i = 0 To Errors.Count - 1
> > > > MsgBox (Errors(i).Description)
> > > > Next
> > > > End If
> > > > End Sub
> > > >
> > > >
> > >
> > >
> >
> >
>
>