I
Ian
Hello, I wonder if anyone can help with this problem.
I'm using the following code to try and print a document and then shut
Word:
Application.PrintOut Copies:=1
Application.Quit (no)
If I put breakpoints on the code and step through it, then the
document prints and then Word closes down without saving, exactly as I
would expect it to.
However, if I run the code straight off, it doesn't print. I have
tried pausing for up to 20 seconds between the two commands (in case
the quick shut down was preventing the document from spooling
properly), but I still get no joy. I get the printer icon OK in my
system tray and the document is said to be spooling, but then it goes
without being printed.
This is part of a much larger set of code including table editing
followed by mailmerge (from Excel source), but I have isolated this
code as the problem.
Using in a blank document with just these two lines of code creates
the same problem as when it forms the final part of a much longer
script.
Has anyone got any tips as to how I can print and then close the
session of word. It is pretty vital that I close the session of word.
For anyone interested, the full script is as below (referred to macros
excepted, which are not of relevance to the problem)
=====
Me.Hide 'hides form
Macros.format 'takes out spurious lines in table
Macros.Mergedoc 'mailmerges
Application.PrintOut Copies:=1 'prints merged doc
ActiveWindow.Close (no) ' closes merged doc "Form Letters1"
Application.Quit (no) 'closes word (and template doc)
======
Thanks in advance, Ian ([email protected])
I'm using the following code to try and print a document and then shut
Word:
Application.PrintOut Copies:=1
Application.Quit (no)
If I put breakpoints on the code and step through it, then the
document prints and then Word closes down without saving, exactly as I
would expect it to.
However, if I run the code straight off, it doesn't print. I have
tried pausing for up to 20 seconds between the two commands (in case
the quick shut down was preventing the document from spooling
properly), but I still get no joy. I get the printer icon OK in my
system tray and the document is said to be spooling, but then it goes
without being printed.
This is part of a much larger set of code including table editing
followed by mailmerge (from Excel source), but I have isolated this
code as the problem.
Using in a blank document with just these two lines of code creates
the same problem as when it forms the final part of a much longer
script.
Has anyone got any tips as to how I can print and then close the
session of word. It is pretty vital that I close the session of word.
For anyone interested, the full script is as below (referred to macros
excepted, which are not of relevance to the problem)
=====
Me.Hide 'hides form
Macros.format 'takes out spurious lines in table
Macros.Mergedoc 'mailmerges
Application.PrintOut Copies:=1 'prints merged doc
ActiveWindow.Close (no) ' closes merged doc "Form Letters1"
Application.Quit (no) 'closes word (and template doc)
======
Thanks in advance, Ian ([email protected])