Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Auto answer a word dialog box from VB

Posted on 1997-06-08
2
Medium Priority
?
246 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

885 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