Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

unattended execution to suppress all user interface

Posted on 2004-08-09
5
Medium Priority
?
554 Views
Last Modified: 2013-12-25
I have a project to open a word document and print it out to a ps printstream.  I want to suppress all pop-up window including the "password" dialogue that will be asked for a password protected document.  I expect the open operation fail and return within VB.  However, the window show up and hang the automation process. Please help

I aleady set the project property as
  1. project type = ActiveX DLL
  2. checked "Unattended execution"
  3. Threading Model = "Apartment Threaded"
  4. checked "Upgrade ActiveX Controls"
but the password dialogue still pop-up.

Thanks

0
Comment
Question by:joekslam
[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
  • 3
5 Comments
 
LVL 11

Expert Comment

by:Steiner
ID: 11752803
Since those messageboxes come from Word itself, you'll have to look there. What kind of password is it, do you know it and what should be done if your program can't open the doc because the passwd is wrong?

If it's just the writepasswd and you want to read only, use:
Application.Documents.Open filename:="E:\test\protected.doc", readonly:=true

If you know the passwords, use:
Application.Documents.Open filename:="e:\test\protected.doc", passworddocument:="test", writepassworddocument:="test"
0
 
LVL 11

Accepted Solution

by:
Steiner earned 375 total points
ID: 11752864
Or if don't want to open the file then, use a combination:

Application.DisplayAlerts=wdAlertsNone
On Error Resume Next
Application.Documents.Open filename:="e:\test\protected.doc", passworddocument:="wrongpasswd", writepassworddocument:="wrongpassword"
On Error Goto 0
Application.DisplayAlers=wdAlertsAll

It first disables the WordAlerts (should work for other alerts, too), then disables the error-message from VBA since the file could not be opened. The I try to open the document, giving it 2 (wrong) passwords, so the dialog is not shown. After that, I reenable the errorhandler and alerts.
0
 
LVL 11

Expert Comment

by:Steiner
ID: 11752879
Just forgot the "t" in the last DisplayAlerts
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Suggested Courses

604 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