Solved

Auto answer a word dialog box from VB

Posted on 1997-06-08
2
241 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 50 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

636 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