Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Auto answer a word dialog box from VB

Posted on 1997-06-08
2
Medium Priority
?
243 Views
Last Modified: 2008-03-17
I'm only a beginner at the VB game as I've only just had a three day course but thought that I'd dive in at the deep(ish) end - but I'm stuck.

I currently writing a system whereby I receive data from an AS/400 and produce a 'standard' letter made up of various paragraphs (held as individual Word documents) with variable inserted as into the text.  The choice of paragraph is dependant upon the AS/400 data.

I've got VB opening up Word, then loading a base (empty) document with the mail merge set up.  I then insert the appropriate paragraph texts.  All this works fine until I come to print.  I send off the .mailmerge command to Word which seems to work fine except that Word then opens up a  Dialog box requesting the number of copies etc.  

What I am unable to do is automatically reply an OK to this.  I've tried using SendKeys, I've tried just to send a carriage return but to no avail.

I need to auto reply as this system is to sit on a machine all days processing letter requests and shouldn't require user intervention.

Can anyone out there help ??

Thanks in advance
Guy
0
Comment
Question by:Willow060797
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Expert Comment

by:tward
ID: 1426984
Through OLE Word shouldn't prompt for anything.  Maybe post some code that you are using to do this...  If Sendkeys didn't work with an return maybe OK isn't the default button on the MessageBox being displayed, Try maybe sending something like an ALT-O or whatever...
0
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 100 total points
ID: 1426985
Assuming that you are using OLE to open your document and do your stuff, the command that you are looking for is FilePrint.

Something like this:

  Dim objWord as Object

  Set objWord = CreateObject("WordBasic")
  objWord.FileOpen ("MyFile.DOC")
  (do your stuff here)
  objWord.FilePrint
  objWord.FileSaveAs ("MyNewDoc.doc")
  Set objWord = Nothing


Hope this helps

Chris
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question