Automating printing in a mess !!

A

Alex

Hi Neby needing help please!!

We have a number of different automated letters that need to be sent every
day, and I am trying to automate as far as possible, their loading and
printing.

The Data is held in an Access table, whilst the letters are Mail-merge
within Word. I use a separate query to pass the correct data to each
letter.

I have a button which the user presses and what I want to happen is:
Word Activated
User prompted to ensure correct printer and settings selected.
First letter loaded
User to activate mail-merge
First letter to be closed
User prompted to ensure correct printer and settings selected.
First letter loaded
etc etc

My code works until I get to the code below - line marked with **
I then get and error message :Run Time error 462 - The remote server machine
does not exist or is unavailable

Can someone explain what I am doing wrong please

Thanks

Alex

Set WordApp = GetObject(, "Word.Application")
On Error GoTo 0
clsPBar.IncOne
clsPBar.HideProgress

StrDocName = "Moustraining Brochure"
strPathDoc = strDirPath & "Moustraining Brochure"
PMessage = " About to print MT Brochure letters. Set Printer to Bart,
Right Deck(1), Double Sided"
MsgBox PMessage, , "The Modbury Group"
Set WordDoc = WordApp.Documents.Open(strPathDoc)
WordApp.Visible = True
AppActivate "Microsoft Word"
WordApp.WindowState = 0 'wdWindowStateRestore


StrDocName = "Moustraining Enrolment Form"
strPathDoc = strDirPath & "Moustraining Enrolment Form"
PMessage = " About to print MT Brochure & Enrolment letters. Set Printer
to Bart, Right Deck(1), Double Sided"
MsgBox PMessage, , "The Modbury Group"
** Set WordDoc = WordApp.Documents.Open(strPathDoc)
AppActivate "Microsoft Word"
WordApp.WindowState = 0 'wdWindowStateRestore
 

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