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

x
?
Solved

Disable dialogue box

Posted on 2002-07-02
5
Medium Priority
?
238 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 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