By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

PDFWriter and VB

P: n/a
Does anyone have an example of using PDFWriter (4.0 or later) from VB or VBA
code?

Specifically, how to use Adobe's PDFDocInfo when calling the Window Printer
Escape API to name to document and prevent the dialog box from displaying.

Thanks in advance. Please e-mail sample code to me.

Ray Woerner
(rp****@netzero.net)

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You know, it would have been shorter to do a search in google and get your
answer immediately. It is very documented.
http://groups.google.com/groups?q=PD...TF-8&scoring=d

"Ray Woerner" <rp****@netzero.net> wrote in message
news:ag*****************@sam.nntpserver.com...
Does anyone have an example of using PDFWriter (4.0 or later) from VB or VBA code?

Specifically, how to use Adobe's PDFDocInfo when calling the Window Printer Escape API to name to document and prevent the dialog box from displaying.

Thanks in advance. Please e-mail sample code to me.

Ray Woerner
(rp****@netzero.net)

Nov 13 '05 #2

P: n/a
Hi,

i tried to manipulate the windows registry to print automaticly, but
it doesn't work fine.

CODE

Const HKEY_CURRENT_USER = &H80000001
Const KEY_ALL_ACCESS = &H3F
Const REG_SZ = (1)

Const VER_PLATFORM_WIN32_S = 0
Const VER_PLATFORM_WIN32_WINDOWS = 1 ' Windows 9x
Const VER_PLATFORM_WIN32_NT = 2 ' Windows NT or 2000

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' "Service Pack xx"
End Type

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As
Long) As Long

Private Declare Function WritePrivateProfileString Lib "kernel32"
Alias _
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As
String) As Long

Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias
"RegDeleteValueA" _
(ByVal hKey As Long, ByVal lpValueName As String) As Long

Private Declare Function RegSetValueEx Lib "advapi32" Alias
"RegSetValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As
Long, _
ByVal dwType As Long, ByVal szData As String, ByVal cbData As Long)
As Long

Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, _
ByVal lpSubKey As String, ByVal ulOptions As Long, _
ByVal samDesired As Long, phkResult As Long) As Long

Private Declare Function GetVersionEx Lib "kernel32" Alias
"GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long


lResult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Adobe\Acrobat
PDFWriter", 0, KEY_ALL_ACCESS, phKey)

lResult = RegSetValueEx(phKey, "PDFFileName", 0, REG_SZ, p_filename,
CLng(Len(p_filename)))
bRes = WritePrivateProfileString("Acrobat PDFWriter", "PDFFileName",
p_filename, "c:\windows\system\pdfwritr.ini")

Application.PrintOut FileName:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=False, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0,
PrintZoomPaperHeight:=0
lResult = RegDeleteValue(phKey, "PDFFileName")
lResult = RegCloseKey(phKey)
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.