?
Solved

Disable dialogue box

Posted on 2002-07-02
5
Medium Priority
?
237 Views
Last Modified: 2010-05-02
hi experts,

Can anybody help me? It is urgent!! I'm writing a VB program using PDFWriter driver to convert my Word doc to pdf. My problem is it keeps on asking me for a filename. My program is a batch process that needs to create individual pdf file for each record.

  Dim msWord As Word.Application
  Set msWord = GetObject(Class:="Word.Application.8")

  msWord.Visible = False
  msWord.ActivePrinter = "Acrobat PDFWriter"
  msWord.Documents.Open "c:\temp\spec.doc"
  msWord.ActiveDocument.PrintOut    

How to convert a file in other language such as chinese? Convertion in english version is correct.
Thanks!!
0
Comment
Question by:wilsontang
[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
5 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7125821
hearing...
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 7126251
0
 
LVL 1

Accepted Solution

by:
sclaverie earned 1200 total points
ID: 7335314
Hey,

Using PDFWriter, you can "print" the Word document to a specific pdf file, without the dialog.  You will have to set a few Abode registry settings, but one of them will be to turn the dialog off as well as to specify the name of the file.  
All the registry settings are defined in the Acrobat PDFWriter API Reference pdf file shipped with the full version of Acrobat (Program Files\Adobe\Acrobat SDK\Documentation\PDF_Creation_APIs). All registry keys related to saving/previewing the pdf file using the PDFWriter can be found under HKCU/Software/Adobe/Adobe PDFWriter.

Here's some code using Word automation and PDFWriter.

'********************************
Public Const AdobeKey = "SOFTWARE\Adobe\Acrobat PDFWriter\"


Public Sub WordToPDF()

Dim oleWord As Word.Application
Dim WordDoc As Word.Document
Dim oldPrinter As String

'We are changing the Printer in Word to PDFWriter, so save the old printer here
oldPrinter = cSetPrinter.m_sPrevPrinterDevName
Set oleWord = New Word.Application

'get word doc
Set WordDoc = oleWord.Documents.Open("c:\somedoc.doc")

'Do whatever you may need to do to the word doc here

SetPDFParams "c:\somedoc.pdf", False, False
oleWord.ActivePrinter = "Acrobat PDFWriter"
WordDoc.PrintOut True
                     
WordDoc.Close False
Set WordDoc = Nothing
Set oleWord = Nothing
cSetPrinter.SetPrinterAsDefault oldPrinter
end sub


Public Sub SetPDFParams(Filename As String, Landscape As Boolean, ShowViewer As Boolean)
'This sets the registry settings for Adobe
Dim regsuccess As Long

On Error Resume Next
'regsuccess = RegWriteString(HKEY_CURRENT_USER, AdobeKey, "bDocInfo", "1")
regsuccess = RegWriteString(HKEY_CURRENT_USER, AdobeKey, "PDFFileName", Filename)

If ShowViewer Then
   regsuccess = RegWriteString(HKEY_CURRENT_USER, AdobeKey, "bExecViewer", "1")
Else
   regsuccess = RegWriteString(HKEY_CURRENT_USER, AdobeKey, "bExecViewer", "0")
End If

If Landscape Then
   regsuccess = RegWriteString(HKEY_CURRENT_USER, AdobeKey, "orient", "2") 'Portrait = 1, Landscape = 2
Else
   regsuccess = RegWriteString(HKEY_CURRENT_USER, AdobeKey, "orient", "1")
End If

End Sub
'********************************

Hope that helps.

Later...
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7971229
Hi wilsontang,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept sclaverie's comment(s) as an answer.

wilsontang, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8018771
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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 Month14 days, 16 hours left to enroll

770 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