RE: Mailmerge works for me but not my client!



Have fixed this now myself. I discovered the fix in KB825765 which requires a
registry modification. In fact I had already done this before for my
maintenance account but failed to document it properly and forgot I had done
it! Easy moral to this story - make good notes of all you do!

"rustle" wrote:

I am vexed at why the code below sometimes works and sometimes doesn't. I
developed the application on my PC and then transferred it to the client's
PC. On his PC are 2 user accounts - one I use for maintenance and the
client's. Both are full admin accounts (not my decision!). If I run the app
with me logged on it works fine. If I run it with him logged on it fails at
this line shown. If I open the master document with Word from his user
account it opens and merges successfully.

The circumstances at failure are strange. There is an error message (as
shown in comment above the line which fails). It's format is what results
from the "Err_ZZZ" code at the bottom - even if I put <On Error Goto 0>
immediately above the offending line! Of course this could be triggering the
error trap from a routine somewhere else in my code as I use this type of
error trap everywhere - but this looks like a bug in Access / Word.

My conclusion is that opening Word has caused the application to misbehave.
However I am at a loss as to how to find the cause and fix it. Any ideas
gratefully received.

By the way, I am appalled at the really clumsy way Word and Access interact.
I want to avoid the client having to mess with the mailmerge in Word so I am
trying to do this within my Access application. When the mailmerge letters
are created I then close Access and let him click on the merged letters
(saved on his desktop) so as to use Word to print them (or if he wants to
edit some of them first). If anyone has a suggestion as to how to do this
better please advise.

I'm not entirely comfortable with my solution as when it runs ok, the
invocation of Word from within my Access database code opens another instance
of the database to get the query data. Not really a prbblem but it seems
crude.

Russell Gadd




Public Sub MergeLetters(strMergedLetters As String)
On Error GoTo Err_ZZZ

Dim objMSWord As New Word.Application
Dim objMasterDoc As Word.Document

'The filenames below are valid
Set objMasterDoc = objMSWord.Documents.Open(strMailMergeDocsPath &
strMasterDocName)

'note that this doc has already got the record source defined as the
correct query in the database
'and has been saved immediately after a successful merge
'I just want to reopen it with the query reflecting new data

'LINE BELOW FAILS with message - This method or property is not available
because the document is not a mail merge main document
'(I can assure you it is and works when run by a different user!)
objMasterDoc.MailMerge.Execute

objMSWord.Application.Documents(1).SaveAs (strMergedLetters)

'close the merge MasterDoc without saving
objMasterDoc.Close wdDoNotSaveChanges

Exit_ZZZ:
objMSWord.Application.Quit
Set objMSWord = Nothing
Set objMasterDoc = Nothing
Exit Sub
Err_ZZZ:
MsgBox Err.Description & vbCrLf & "Error number " & Err.Number
Resume Exit_ZZZ
End Sub
.



Relevant Pages

  • Re: Backup jobs
    ... This is likely to be either a permissions problem or a sharing violation ... account is the security context for jobs, and thus the maintenance plan. ... delete an expired backup. ...
    (microsoft.public.sqlserver.server)
  • Re: OWC COM Object Credentials in ASP.NET and Web Services
    ... I did fix this issue once. ... you will need to make sure that the account is part of the OLAP ... > was to set the ASPCOMPAT property of the web form page to true. ... > the code is sitting in code behind form, BUT NOT FOR WEB SERVICES. ...
    (microsoft.public.office.developer.web.components)
  • Re: Outlook 2007 woes - getting stuck at "updating cached messages
    ... and then "updating cache 250/xxx" issue crops up through ... Good thing I have iphone and web access to this email account. ... I can watch it go into an infinate loop of send/recieve, ... FIX - I deleted and re-established my IMAP account, ...
    (microsoft.public.outlook)
  • Re: Sql 2000 Maintenance Plan not deleting old transaction logs
    ... this was simply the most comprehensive backup we could make. ... The maintenance plan is run as a job, and jobs are run by the ... account is the security context for jobs, ... I'd rather not have to delete these extra backup files ...
    (microsoft.public.sqlserver.tools)
  • Outlook 2003/Gmail/Default Mail Client/Error
    ... but I can't seem to find a definitive fix. ... "Either there is no default mail client or the current mail client ... noticed it would happen even when Outlook was shut down. ... Yes, I have another POP account w/my ISP, no I do not have an Exchange ...
    (microsoft.public.outlook.general)