Albert Kallal - mail merge

H

hughess7

Hi - question to Albert (or anyone else who may be able to help?)

I have got Albert's code working to mail merge to word using the
MergoNoPrompt code, I have managed to successfully print from this direct to
a autonamed PDF file :). A BIG 'thanks' go to Albert for providing this
superb useful code and instructions...

My question is though it leaves Word open, it closes the document but the
application itself remains. How (and where in the code?) would I add a
command to close Word? Do I just need to put wordApp.Quit somewhere? The only
complication with this would be if the user already had word opened, then
maybe it shouldn't get closed...

Thanks in advance for any help.
Sue
 
T

Tom van Stiphout

On Fri, 3 Apr 2009 05:09:01 -0700, hughess7

I don't know Alberts code, but I would expect that at startup time he
does a GetObject("Word.Application") and if that fails a
CreateObject("Word.Application"). Search the code for those two
keywords. If yes, the objective is for GetObject to grab a reference
to Word if it is already running, and if not use CreateObject to
create a new instance. This is where you would set a flag (a global
Boolean) to remember if it was the one or the other.

Then at shutdown time you can write:
if g_blnCreatedMyOwnInstance = True
wordApp.Quit
end if

-Tom.
Microsoft Access MVP
 
A

Albert D. Kallal

hughess7 said:
Hi - question to Albert (or anyone else who may be able to help?)


My question is though it leaves Word open, it closes the document but the
application itself remains. How (and where in the code?) would I add a
command to close Word? Do I just need to put wordApp.Quit somewhere? The
only
complication with this would be if the user already had word opened, then
maybe it shouldn't get closed...

Actually, if word is not running, then I launch a copy of word.

However, if word is running...then I use that running copy (this makes
the software run much faster and uses less memory).

So, it really is much by design since if you print a few word documents one
after another, you save SIGNIFICANT processing and response time by leaving
word running.
The only
complication with this would be if the user already had word opened, then
maybe it shouldn't get closed...

You much hit the nail here. More important if we just launch a copy of word
and merged data, we "often" then allow the user to edit that document.

However, I suppose for printing cases we should load a separate copy of
word, print and then shut down word.

If I can assume you using the print option of my library, then it does make
sense to launch a separate copy.

I just modified my code library to do this. So, you can download the
latest copy, and them simply delete your code module called

wordCode, and them re-import my example...

The start + shutdown of word will ONLY occur if you using MergeNoPrompts
which allows printing of documents...

The download is here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html


the code changes occurred in module WordCode, and I changed the routine
called RidesMergeWord

The changes are:

On Error GoTo CreateWordApp

If bolPrint = True Then
' we printing a document, so lets launch a seperate copy of word
' as not interfere with the the user's current open copy of word

Set wordApp = GetObject("Word.Application")
Else
Set wordApp = GetObject(, "Word.Application")
End If

On Error Resume Next


The above is near the start...and towards the end I have:

If bolPrint = False Then
wordApp.Visible = True
End If

and

MyPbar.HideProgress

If bolPrint = True Then
' shutdown word
wordApp.Quit
Else
Set wordApp = Nothing
End If
 
H

hughess7

Thank you very much Albert! I will download your amended code and try it out
with my application.

Thanks again
Sue
 
A

Albert D. Kallal

hughess7 said:
Hi again, I downloaded your code but the mdb was dated 7 Feb 09 and did
not
seem to have been amended. Am I downloading the correct file? It is on
your
website:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

under Super Easy Word Merge, Access 2000 download (WordMerge2008.zip)

"Albert D. Kallal" wrote:

Yes..that is the correct url.....

Open the module "WordCode"

Scroll down past the var defines and take a look at the revisions
history......

Note that I ONLY launch a new copy of word and then shutdown that copy of
word WHEN you print a document.

So if you just executing a standard merge but no print, then things will
work as before.

This much means that you only notice a change when using the MergeNoPrompts.
The use of MergeNoPrompts is explained here:

http://www.members.shaw.ca/AlbertKallal/wordmerge/page2.html
 
H

hughess7

Sorry for the trouble, downloaded again but I don't think the version on your
website is the updated version? The revision history last date is Feb still
and the bolprint statements are:

If bolPrint = False Then
wordApp.Visible = True
wordApp.Activate
wordApp.WindowState = 0 'wdWindowStateRestore
End If

and

If bolPrint = False Then

WordDocM.Activate

Else
 
A

Albert D. Kallal

hughess7 said:
Sorry for the trouble, downloaded again but I don't think the version on
your
website is the updated version? The revision history last date is Feb
still
and the bolprint statements are:

The reviesin history in the module WordCode sould be:

' Feb 07, 2009 ADK - Added code for using the new "docx" extension for
word
' 2007

' Apr 06, 2009 ADK - Added code for MergeWord that when you are
printing
' a document, I launch a separate instance of word,
do
' not let the document become visible, and then shut
' that instance of word.
' Apr 06, 2009 ADK - Moved the revision history from MergeWord Routine
to
' to here.
' Apr 06, 2009 ADK - Changed names of MergeWord, EditTempate etc.
' (removed the Rides prefix)


Try downloading on a different computer. Something is messed up with your
browser cache.....

Here is the direct link:

http://www.members.shaw.ca/AlbertKallal/msaccess/WordMerge2008.zip
 
H

hughess7

Brilliant! That got it thanks :)

I have been having trouble with the office discussion website lately - I
keep getting service unavailable messages, java errors etc etc when trying to
view previous posts, and the site has been generally very slow. Might be a
seperate issue though...
 
T

Tom Wickerath

Hi Hughess7,

It is a separate issue....the "WebNews" interface problems with Service
Unavailable, and generally slow, have been reported to Microsoft. Hopefully,
they will take the problem seriously and fix it sooner rather than later.

You always have the option of using newsreader software (or even Outlook
Express) to access these newsgroups.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/

__________________________________________


Brilliant! That got it thanks :)

I have been having trouble with the office discussion website lately - I
keep getting service unavailable messages, java errors etc etc when trying
to
view previous posts, and the site has been generally very slow. Might be a
seperate issue though...
 
H

hughess7

Hi Tom

Thanks! I searched this forum and found the newsgroup server address and I
have added the newsgroups to my outlook express :).

I do however seem to be having some teething problems in replying to
messages and searching for messages too. My email address to logon to the
website is different from my real email address, I just use it for my windows
live logon. Do you need to tick the box for 'requires logon' when setting up
the newsgroups for replying?

Also, I know, for example, there is a post with the subject of 'Performance
on this website' which I was interested in reading, but I can not open it
from the website ('Community ..' error) and I can't find it from doing a
search on the newsgroups in OE. I guess I haven't either downloaded ALL
messages or newsgroups maybe.

Sue
 
H

hughess7

Albert, downloaded and tested all ok - thank you very much again!

One small point, just before the pdf is produced there is a message on
screen with a cancel button but it disappears to quickly to read or press. I
presume it may be a print message but I can't see where this is coming from
to stop it - any ideas?

Cheers
Sue
 
T

Tom Wickerath

Hi Sue,

I have "news.microsoft.com" as the newsserver for my configuration in
Outlook Express.
My email address to logon to the website is different from my
real email address, I just use it for my windows live logon.

I use a "munged" e-mail address as well--one that a human can guess
reasonably easy, but that (hopefully) foils e-mail address harvesting bots.
There is no need for a Windows Live Logon when using Outlook Express as a
newsreader.
Do you need to tick the box for 'requires logon' when setting
up the newsgroups for replying?

No. I do not have this option checked.

I could not find the thread you referenced by using Google Advanced Groups,
or MS Live Search. Perhaps it's a case of Microsoft removing 'dirty laundry'
so that others would not be able to read the thread? <smile>

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________


Hi Tom

Thanks! I searched this forum and found the newsgroup server address and I
have added the newsgroups to my outlook express :).

I do however seem to be having some teething problems in replying to
messages and searching for messages too. My email address to logon to the
website is different from my real email address, I just use it for my
windows
live logon. Do you need to tick the box for 'requires logon' when setting up
the newsgroups for replying?

Also, I know, for example, there is a post with the subject of 'Performance
on this website' which I was interested in reading, but I can not open it
from the website ('Community ..' error) and I can't find it from doing a
search on the newsgroups in OE. I guess I haven't either downloaded ALL
messages or newsgroups maybe.

Sue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top