Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2007, 06:39 AM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sunilbedre
Default 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create word file in asp.net,c# mohini ASP.NET 2.0 Professional 11 March 1st, 2012 06:38 AM
Dot net - Converting word to pdf and pdf to word Manoah Classic ASP Basics 2 July 7th, 2008 10:21 PM
Convert PDF, Word file to HTML Snowby PHP How-To 0 March 18th, 2008 08:08 AM
Create pdf file using PHP angshujit PHP How-To 1 February 24th, 2007 10:07 AM
create pdf file aytacakin J2EE 1 September 5th, 2005 11:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.