View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Excel vba printout method

Rats.

Curtis,

According to the pdf.xla (Acrobat 5.0) the .ini for winnt is in a winnt
subfolder SystemRoot$ + "\System32\Spool\Drivers\W32X86\"

It DOES NOT always have the name pdfwritr.ini. My XP sys uses the
"2\__pdf.ini"


If (bWinNT) Then
SystemRoot$ = GetPrivateProfileSetting(BaseKey:=HKEY_LOCAL_MACHI NE,
_
Section:="Software\Microsoft\Windows NT\CurrentVersion",
_
Setting:="SystemRoot")
iniFilename = SystemRoot$ + "\System32\Spool\Drivers\W32X86\"
If (bWinNT351) Then
iniFilename = iniFilename + "1\__pdf.ini"
Else
iniFilename = iniFilename + "2\__pdf.ini"
End If
Else
SystemRoot$ = GetPrivateProfileSetting(BaseKey:=HKEY_LOCAL_MACHI NE,
_
Section:="Software\Microsoft\Windows\CurrentVersio n", _
Setting:="SystemRoot")
iniFilename = SystemRoot$ + "\System\PDFWritr.ini"
End If



--

John

johnf202 at hotmail dot com


"Tom Ogilvy" wrote in message
...
Curtis previously stated:
I'm using excel 97 sr-2 on winnt 4.0

PrToFileName was not introduced until xl2000.

--
Regards,
Tom Ogilvy


jaf wrote in message
...
Hi Curtis,
PrToFileName is what your looking for.


Sub test()
Dim Output
Close
Output = "mytest.pdf"
Debug.Print Output
Sheets(1).Activate
Application.ActivePrinter = "Acrobat PDFWriter on LPT1:"
ActiveWindow.SelectedSheets.PrintOut _
Copies:=1, PrintToFile:=True, PrToFileName:="C:\Documents and
Settings\jaf\My Documents\mytest.pdf"

End Sub

--

John

johnf202 at hotmail dot com


"Curtis" wrote in message
om...
Hello all,

I've went throw all posts on vba excel printout codes and none worked.

I am using excel to create a file and i want to save it in pdf format
but dont want the popup that asks the filename to save under

here is the code that i'm using:

Application.ActivePrinter = "Adobe PDFWriter sur LPT1:"
ActiveWorkbook.SaveAs FileName:="C:\toto.xls"
ActiveWorkbook.PrintOut

I've tried specifying parameter of printout with no success

Help please
Curtis