Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word Bookmark should close after Go To and remain open after Add | Microsoft Word Help | |||
How to Close original Document after executing MailMerge. | Mailmerge | |||
Mail Merge - Parameter prompts twice... | Mailmerge | |||
How do I get defined open and close double quote marks? | Microsoft Word Help | |||
Why does Word ask if I want to make a copy when I open a document. | Microsoft Word Help |