I wonder if anyone can help.

I realise my programming logic is flawed, but any help of a different
approach would be grate-fully received.

I'm writing a routine in VBA that mail merges Word from an Access
database, and obviously creates another merged document.

What I want to do is close the original document (taking with it the
instance of Access that has been opened).

I can successfully do this, but when returned to the new document the
VBA environment has frozen because End Sub hasn't been executed.

ie

Set MergeDoc = ActiveDocument
.
.
.

MergeDoc.Close wdDoNotSaveChanges
End Sub

Has anyone got any ideas how to close this original document without
causing a hang?

TIA

Steve

(I realise this method is horrible programming practice, but I'm
really stuck)

Re: Word Mail Merge Problem by Jezebel

Jezebel
Wed Feb 23 05:44:43 CST 2005

There's nothing horrible about that in itself, and it shouldn't be causing
the hang. There must be something else going on. VBA doesn't freeze 'because
the End Sub hasn't been executed'.




"Steve" <blairsteve@hotmail.com> wrote in message
news:1109158104.226360.91400@z14g2000cwz.googlegroups.com...
>I wonder if anyone can help.
>
> I realise my programming logic is flawed, but any help of a different
> approach would be grate-fully received.
>
> I'm writing a routine in VBA that mail merges Word from an Access
> database, and obviously creates another merged document.
>
> What I want to do is close the original document (taking with it the
> instance of Access that has been opened).
>
> I can successfully do this, but when returned to the new document the
> VBA environment has frozen because End Sub hasn't been executed.
>
> ie
>
> Set MergeDoc = ActiveDocument
> .
> .
> .
>
> MergeDoc.Close wdDoNotSaveChanges
> End Sub
>
> Has anyone got any ideas how to close this original document without
> causing a hang?
>
> TIA
>
> Steve
>
> (I realise this method is horrible programming practice, but I'm
> really stuck)
>