to create PDF from word file
Hi All,
I've a problem while creating PDF from the word document. My concern in the below given code, if i say printtofile=false and giving output file name it consider as prn file. by default it should take the Pdf format. Please can anyone help me.....
Dim Filename As String
Selection.HomeKey Unit:=wdStory
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdNextRecord
Selection.GoTo What:=wdGoToField, Which:=wdGoToNext, Count:=1, Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Filename = Selection.Text
ActivePrinter = "PDF Writer (Ghostscript)"
Application.PrintOut Filename:="", Range:=wdPrintAllDocument, OutputFileName:="C:\" & Filename &, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
Collate:=False, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
End Sub
Sunil
|