Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Open copy of merge doc, close original without saving

I found the code to do this on another area of this newsgroup, but it doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just opens the
orginal merge document. No errors, no debug, no copy that I can see.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Open copy of merge doc, close original without saving

The first problem is that when you automate Word, it doesn't necessarily
open its data source - see

http://support.microsoft.com/kb/825765/en-us

Peter Jamieson
"Todd K." wrote in message
...
I found the code to do this on another area of this newsgroup, but it
doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just opens
the
orginal merge document. No errors, no debug, no copy that I can see.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Open copy of merge doc, close original without saving

I have heard of this issue before, and I think at this point I am fine with
having the users click Yes at the prompt for letting the SQL run. Once we
click Yes though, shouldn't it run the code?

"Peter Jamieson" wrote:

The first problem is that when you automate Word, it doesn't necessarily
open its data source - see

http://support.microsoft.com/kb/825765/en-us

Peter Jamieson
"Todd K." wrote in message
...
I found the code to do this on another area of this newsgroup, but it
doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just opens
the
orginal merge document. No errors, no debug, no copy that I can see.




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Open copy of merge doc, close original without saving

Well, i just tried something like this and the SQL registry setting didn't
obviously make a difference. However, what does happen depends on the code
you're running in Access.

What happened on my system was that when I opened the document (from an
Access VBA routine), Word did open and execute the merge. Then your code
closes the mail merge main document. It's helpful to make Word visible
before opening the document so you can see what's happening. If you don't do
that, you won't see anything.

Anyway, after the macro runs, the result document is there in Word. However,
if you are running from an Access module that sets the Word object to
nothing or quits Word, chances are you will either be left with invisible
WINWORD processes in your Windows task list, or the output document will
just be deleted.

Peter Jamieson

"Todd K." wrote in message
news
I have heard of this issue before, and I think at this point I am fine with
having the users click Yes at the prompt for letting the SQL run. Once
we
click Yes though, shouldn't it run the code?

"Peter Jamieson" wrote:

The first problem is that when you automate Word, it doesn't necessarily
open its data source - see

http://support.microsoft.com/kb/825765/en-us

Peter Jamieson
"Todd K." wrote in message
...
I found the code to do this on another area of this newsgroup, but it
doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just opens
the
orginal merge document. No errors, no debug, no copy that I can see.






  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Open copy of merge doc, close original without saving

The code I run in Access simply does a hyperlink to open up the Word document
(Application.FollowHyperlink "I:\Applications\Databases\Amendment_Ren.doc") ,
it's the code below in the Word document that is supposed to open up a copy
and close the original. I guess I have two questions:

1) If I adjust the SQL registry setting, will it allow the code below to
operate in the Word document?
2) If not, what else could it be?

"Peter Jamieson" wrote:

Well, i just tried something like this and the SQL registry setting didn't
obviously make a difference. However, what does happen depends on the code
you're running in Access.

What happened on my system was that when I opened the document (from an
Access VBA routine), Word did open and execute the merge. Then your code
closes the mail merge main document. It's helpful to make Word visible
before opening the document so you can see what's happening. If you don't do
that, you won't see anything.

Anyway, after the macro runs, the result document is there in Word. However,
if you are running from an Access module that sets the Word object to
nothing or quits Word, chances are you will either be left with invisible
WINWORD processes in your Windows task list, or the output document will
just be deleted.

Peter Jamieson

"Todd K." wrote in message
news
I have heard of this issue before, and I think at this point I am fine with
having the users click Yes at the prompt for letting the SQL run. Once
we
click Yes though, shouldn't it run the code?

"Peter Jamieson" wrote:

The first problem is that when you automate Word, it doesn't necessarily
open its data source - see

http://support.microsoft.com/kb/825765/en-us

Peter Jamieson
"Todd K." wrote in message
...
I found the code to do this on another area of this newsgroup, but it
doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just opens
the
orginal merge document. No errors, no debug, no copy that I can see.








  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Open copy of merge doc, close original without saving

OK, when I do it that way, the main thing that stops anything from happening
is when I set macro Security in Word to High, i.e. so Word simply won't run
the macros unless the conditions are right.

Peter Jamieson

"Todd K." wrote in message
...
The code I run in Access simply does a hyperlink to open up the Word
document
(Application.FollowHyperlink
"I:\Applications\Databases\Amendment_Ren.doc") ,
it's the code below in the Word document that is supposed to open up a
copy
and close the original. I guess I have two questions:

1) If I adjust the SQL registry setting, will it allow the code below to
operate in the Word document?
2) If not, what else could it be?

"Peter Jamieson" wrote:

Well, i just tried something like this and the SQL registry setting
didn't
obviously make a difference. However, what does happen depends on the
code
you're running in Access.

What happened on my system was that when I opened the document (from an
Access VBA routine), Word did open and execute the merge. Then your code
closes the mail merge main document. It's helpful to make Word visible
before opening the document so you can see what's happening. If you don't
do
that, you won't see anything.

Anyway, after the macro runs, the result document is there in Word.
However,
if you are running from an Access module that sets the Word object to
nothing or quits Word, chances are you will either be left with invisible
WINWORD processes in your Windows task list, or the output document will
just be deleted.

Peter Jamieson

"Todd K." wrote in message
news
I have heard of this issue before, and I think at this point I am fine
with
having the users click Yes at the prompt for letting the SQL run.
Once
we
click Yes though, shouldn't it run the code?

"Peter Jamieson" wrote:

The first problem is that when you automate Word, it doesn't
necessarily
open its data source - see

http://support.microsoft.com/kb/825765/en-us

Peter Jamieson
"Todd K." wrote in message
...
I found the code to do this on another area of this newsgroup, but it
doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just
opens
the
orginal merge document. No errors, no debug, no copy that I can
see.








  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Open copy of merge doc, close original without saving

Jamieson, you're a genius! I hadn't even thought about reducing security in
Word, once I did, the code worked perfectly.

Thanks!

"Peter Jamieson" wrote:

OK, when I do it that way, the main thing that stops anything from happening
is when I set macro Security in Word to High, i.e. so Word simply won't run
the macros unless the conditions are right.

Peter Jamieson

"Todd K." wrote in message
...
The code I run in Access simply does a hyperlink to open up the Word
document
(Application.FollowHyperlink
"I:\Applications\Databases\Amendment_Ren.doc") ,
it's the code below in the Word document that is supposed to open up a
copy
and close the original. I guess I have two questions:

1) If I adjust the SQL registry setting, will it allow the code below to
operate in the Word document?
2) If not, what else could it be?

"Peter Jamieson" wrote:

Well, i just tried something like this and the SQL registry setting
didn't
obviously make a difference. However, what does happen depends on the
code
you're running in Access.

What happened on my system was that when I opened the document (from an
Access VBA routine), Word did open and execute the merge. Then your code
closes the mail merge main document. It's helpful to make Word visible
before opening the document so you can see what's happening. If you don't
do
that, you won't see anything.

Anyway, after the macro runs, the result document is there in Word.
However,
if you are running from an Access module that sets the Word object to
nothing or quits Word, chances are you will either be left with invisible
WINWORD processes in your Windows task list, or the output document will
just be deleted.

Peter Jamieson

"Todd K." wrote in message
news I have heard of this issue before, and I think at this point I am fine
with
having the users click Yes at the prompt for letting the SQL run.
Once
we
click Yes though, shouldn't it run the code?

"Peter Jamieson" wrote:

The first problem is that when you automate Word, it doesn't
necessarily
open its data source - see

http://support.microsoft.com/kb/825765/en-us

Peter Jamieson
"Todd K." wrote in message
...
I found the code to do this on another area of this newsgroup, but it
doesn't
appear to work. I have entered the following in a Word module:
Public Sub DoMailMerge()

Dim DocName
DocName = ActiveDocument.Name
'Do mailmerge
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
'Close mailmerge document
Windows(DocName).Close wdDoNotSaveChanges

End Sub

Then in the Document_Open property of my mailmerge document, I wrote
DoMailMerge. But when I open the document (from Access), it just
opens
the
orginal merge document. No errors, no debug, no copy that I can
see.









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
Word Bookmark should close after Go To and remain open after Add Peters19 Microsoft Word Help 1 July 27th 06 02:57 AM
How to Close original Document after executing MailMerge. Don Mailmerge 1 January 14th 06 08:15 AM
Mail Merge - Parameter prompts twice... TL Mailmerge 6 June 17th 05 02:58 PM
How do I get defined open and close double quote marks? merimee Microsoft Word Help 2 January 16th 05 04:32 AM
Why does Word ask if I want to make a copy when I open a document. ROKJO Microsoft Word Help 1 December 10th 04 03:59 PM


All times are GMT +1. The time now is 06:42 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"