View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Wiss Don Wiss is offline
external usenet poster
 
Posts: 300
Default Setting binary values in Registry?

On Wed, 16 Aug 2006 21:13:54 -0400, Don Wiss wrote:

While getting frustrated with Adobe I found this product:
http://www.globalpdf.com/pdfcamp/pdf...el-to-pdf.html

If you read the section on using a program to control it he
http://www.verypdf.com/pdfcamp/support/
You will see how simply something can be designed. My problem is I can't
get it to work. My VBA can't set the ActivePrinter to it.


I did get it to work. It can even append the files, which Adobe Elements
can't do, and would require the purchase of another product. I added the
below function, and then added the block of code just before printing.

Function GetPDFPathName()
' called by Print Menu

Dim OldDrive As String, OldPath As String

' get existing path so we can restore afterwards
OldDrive = Left(CurDir, 2)
OldPath = Application.DefaultFilePath

' get the file name to save as
GetPDFPathName = Application.GetSaveAsFilename(GetNameToStart(True) , "Adobe PDF File,*.pdf", Title:="Save As PDF File")

' restore
ChDrive OldDrive
If OldPath < "" Then ChDir OldPath

End Function


' get the file path name we will put combined PDF in
PDFPathName = GetPDFPathName
' store current printer (we restore after done printing)
prtFirst = Application.ActivePrinter
' change the application printer to Adobe
For j = 1 To 9
Err.Clear
On Error Resume Next
Application.ActivePrinter = "PDFcamp Printer on Ne0" & j & ":"
If Err.Number = 0 Then Exit For
On Error GoTo 0
Next j
On Error GoTo 0

' remove any existing file, as we will be appending
On Error Resume Next
Kill PDFPathName
On Error GoTo 0

' set so nothing will prompt user
SetKeyValue "Software\verypdf\pdfcamp", "AutomaticDirectory", PDFPathName, REG_SZ
SetKeyValue "Software\verypdf\pdfcamp", "AutomaticOutput", 1, REG_DWORD
SetKeyValue "Software\verypdf\pdfcamp", "AutomaticValue", 4, REG_DWORD
SetKeyValue "Software\verypdf\pdfcamp", "AutoView", 0, REG_DWORD


Don <www.donwiss.com (e-mail link at home page bottom).