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

x
?
Solved

convert word to pdf(urgent)

Posted on 2002-06-27
9
Medium Priority
?
552 Views
Last Modified: 2007-12-19
hi experts,

Can anybody help me? It is urgent!! I'm using PDFWriter 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
9 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 7115605
Hi wilsontang,

have you tried something similar as this?
http://www.codecuts.com/mainpage.asp?webpageid=350

they do something like

Function ConvertFile(strSourceFileName As String) As String
On Error GoTo ErrorHandler

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

msWord.Visible = True
msWord.ActivePrinter = "Acrobat Distiller"
msWord.Documents.Open strSourceFileName
msWord.ActiveDocument.PrintOut
msWord.ActiveDocument.Close False

' Should check and quit word when done
Set msWord = Nothing
ConvertFile = True
Exit Function

instead of distiller they use pdfwriter but it is more the way they handle the silent printing

HAGD:O)Bruintje
0
 

Author Comment

by:wilsontang
ID: 7115663
hi bruintje,
        Thanks for your help first.
My program is copied from the site you post. I just have pdf writer driver installed on my computer, no acrobat distiller. So i must set the Active Printer to "Acrobat PDFWriter" as the pdf printer driver name. I want to know which attribute or function of the API "Word.Application.8" can set it to silent printing(no any dialog box pop up)

my program is as follows:

Function ConvertFile(strSourceFileName As String, strDestinationFileName As String) As String

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

   msWord.Visible = False
   msWord.ActivePrinter = "Acrobat PDFWriter"
   msWord.Documents.Open strSourceFileName
   msWord.ActiveDocument.Save
   msWord.ActiveDocument.PrintOut

   msWord.ActiveDocument.Close False

   Set msWord = Nothing
   ConvertFile = True
Exit Function

wilson
0
 

Author Comment

by:wilsontang
ID: 7115692
hi bruintje,
        Thanks for your help first.
My program is copied from the site you post. I just have pdf writer driver installed on my computer, no acrobat distiller. So i must set the Active Printer to "Acrobat PDFWriter" as the pdf printer driver name. I want to know which attribute or function of the API "Word.Application.8" can set it to silent printing(no any dialog box pop up)

my program is as follows:

Function ConvertFile(strSourceFileName As String, strDestinationFileName As String) As String

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

   msWord.Visible = False
   msWord.ActivePrinter = "Acrobat PDFWriter"
   msWord.Documents.Open strSourceFileName
   msWord.ActiveDocument.Save
   msWord.ActiveDocument.PrintOut

   msWord.ActiveDocument.Close False

   Set msWord = Nothing
   ConvertFile = True
Exit Function

wilson
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 44

Expert Comment

by:bruintje
ID: 7115728
seem to get no notifs and i got no way to test here but here's another snippet printing excel sheets to pdf

http://www.codecuts.com/mainpage.asp?WebPageID=293

it seems not to use distiller or pdfwriter maybe worth a try anyway
0
 

Accepted Solution

by:
masterofhisdomain earned 600 total points
ID: 7207611
I found you can do this with your code to have it not prompt you for a file name. (PDF Writer seems to add the pdf extension automatically)

  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 OutputFileName:="C:\temp\spec"  

The problem i have is i get a second empty file when i do this, but i do not get a prompt.

Masterofhisdomain
0
 

Author Comment

by:wilsontang
ID: 7208937
hi Masterofhisdomain,
           Thanks for your replied message!!
I've already fixed my problem. For your problem, I think you can ommit the attribute of OutputFileName. PDFWriter will output the file to the port you select. Go to your PDF distiller's setting, you can add a new PDF port for your output folder.

wilson
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7210300
Hi wilsontang, if you fixed the problem then please post the solution here

:O)Bruintje
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7964630
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 masterofhisdomain'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
 
LVL 5

Expert Comment

by:Netminder
ID: 8014881
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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

609 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