Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Vba printout

Hi all,

I'm using xl2000 on a win2000 with adobe pdfwriter 5.0
to create from a .xls file a .pdf file.


Sub Macro1()
Application.activate = "Acrobat PDFWriter sur LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
ActivePrinter:="Acrobat PDFWriter sur LPT1:", _
PrintToFile:= True, PrToFileName:="C:\test.pdf"
End Sub

What appens is that a file in c:\ is created but cant be viewed
because an error as occurred , no error number, and on desktop file
named test.pdf is created and viewable.

Whats going on I dont understand. Help!

Thanks!
Curtis
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Vba printout

(Curtis) wrote in message . com...
(Curtis) wrote in message . com...
Hi all,

I'm using xl2000 on a win2000 with adobe pdfwriter 5.0
to create from a .xls file a .pdf file.


Sub Macro1()
Application.activate = "Acrobat PDFWriter sur LPT1:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
ActivePrinter:="Acrobat PDFWriter sur LPT1:", _
PrintToFile:= True, PrToFileName:="C:\test.pdf"
End Sub

What appens is that a file in c:\ is created but cant be viewed
because an error as occurred , no error number, and on desktop file
named test.pdf is created and viewable.

Whats going on I dont understand. Help!

Thanks!
Curtis


After some tests I found out that the file that is viewable is saved
in default directory specified in excel tools--option--general. And
the file name/path that is specified in prtofilename is never
viewable.

I still dont have a clue on how to solve this problem.

Curtis


I figured it out
Here is the solution
the printout creates a postscript file then you convert the postscript
file to a pdf file see code that follows

Sub Macro1()
Dim myPDF As PDFDistiller
Set myPDF = New PDFDistiller

' Not needed since you specify it in printout
Application.Activate = "Acrobat PDFDistiller sur LPT1:"

ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
ActivePrinter:="Acrobat PDFDistiller sur LPT1:", _
PrintToFile:= True, PrToFileName:="C:\test.ps"

myPDF.FileToPDF "C:\test.ps", "C:\test.PDF", ""
End Sub

the only thing left is to delete postscript file after creation of pdf
file

Curtis
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Printout becky57 New Users to Excel 3 February 4th 09 01:42 AM
Printout using MFC Sachin Excel Worksheet Functions 0 August 4th 08 11:25 AM
no #VALUE! to printout garyww Excel Worksheet Functions 2 August 15th 06 04:19 PM
no #VALUE! to printout garyww Excel Worksheet Functions 1 August 15th 06 10:15 AM
PRINTOUT Wayne Blosat Excel Programming 0 August 27th 03 09:07 PM


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"