Setting binary values in Registry?

D

Don Wiss

I now have the code from this page in my workbook:
http://support.microsoft.com/default.aspx?scid=kb;en-us;145679&sd=tech
It does not support the writing of binary values.

I found this page: http://www.freevbcode.com/ShowCode.Asp?ID=335
It does write binary values, but the code cannot coexist with the Microsoft
code. I tried to modify it, but I wasn't successful. Has anyone merged
these together?

What I'm trying to do is to "print" to a PDF file completely using VBA and
no user intervention. I have Adobe Elements 6.0 installed. It was not
designed to be run under program control. Some of the settings I want to
change are binary values. For example, I want to turn off
PromptForPDFFilename and ViewPDFFile. Maybe others, if I can figure them
out.

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

If you read the section on using a program to control it here:
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.

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

Don Wiss

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

If you read the section on using a program to control it here:
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top