Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Matthew W Matthew W is offline
external usenet poster
 
Posts: 1
Default Macro Problem With Merge

Hi
I've written a very simple find and replace macro, however when I merge a
document into the template, the macro runs BEFORE the merging (I tested this
with a msgbox that shows the macro has run beforehand). I am using "autonew"
for the macro at the moment but I really want it to wait until after the
merging to run.
Any ideas?

Thanks.
Matthew
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Macro Problem With Merge

Incorporate code in the macro to execute the merge and then have it perform
your find operation on the document that is created by executing the merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Matthew W" Matthew wrote in message
...
Hi
I've written a very simple find and replace macro, however when I merge a
document into the template, the macro runs BEFORE the merging (I tested
this
with a msgbox that shows the macro has run beforehand). I am using
"autonew"
for the macro at the moment but I really want it to wait until after the
merging to run.
Any ideas?

Thanks.
Matthew



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Matthew W[_2_] Matthew W[_2_] is offline
external usenet poster
 
Posts: 1
Default Macro Problem With Merge

Hi
The problem is, is that the merge occurs via an Access VBA application so
the Word document is produced from that and then appears on the screen.

"Doug Robbins - Word MVP" wrote:

Incorporate code in the macro to execute the merge and then have it perform
your find operation on the document that is created by executing the merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Matthew W" Matthew wrote in message
...
Hi
I've written a very simple find and replace macro, however when I merge a
document into the template, the macro runs BEFORE the merging (I tested
this
with a msgbox that shows the macro has run beforehand). I am using
"autonew"
for the macro at the moment but I really want it to wait until after the
merging to run.
Any ideas?

Thanks.
Matthew




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Macro Problem With Merge

I don't know where the Autonew would come into it if the merge is being
performed via an Access application, but then I also can't imagine why you
would be wanting Find and Replace in these circumstances either.



You need to do something like:

Set wrdApp = CreateObject("Word.Application")
wrdApp.Documents.Open FileName:=strDoc, AddToRecentFiles:=False,
Visible:=True
wrdApp.Documents.Item(1).Activate
With wrdApp.Documents(strDoc).MailMerge
.DataSource.FirstRecord = 1
.DataSource.LastRecord = 1
.Destination = wdSendToNewDocument
.Execute
End With
With wrdApp.Documents.Item(1)
'Your find code
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Matthew W" wrote in message
...
Hi
The problem is, is that the merge occurs via an Access VBA application so
the Word document is produced from that and then appears on the screen.

"Doug Robbins - Word MVP" wrote:

Incorporate code in the macro to execute the merge and then have it
perform
your find operation on the document that is created by executing the
merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Matthew W" Matthew wrote in message
...
Hi
I've written a very simple find and replace macro, however when I merge
a
document into the template, the macro runs BEFORE the merging (I tested
this
with a msgbox that shows the macro has run beforehand). I am using
"autonew"
for the macro at the moment but I really want it to wait until after
the
merging to run.
Any ideas?

Thanks.
Matthew






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Seq Numbering - Macro problem Silena K-K Microsoft Word Help 1 May 28th 08 06:04 AM
macro problem gorda[_3_] Microsoft Word Help 1 April 25th 08 09:30 AM
Can anyone help on a macro problem that I have tweacle[_8_] Microsoft Word Help 1 January 10th 08 11:31 AM
macro problem ah Microsoft Word Help 2 October 3rd 07 02:25 PM
Macro toolbar problem Dave Neve Microsoft Word Help 2 August 15th 05 12:38 PM


All times are GMT +1. The time now is 09:48 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"