Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems automating PDF reports with Acrobat 6.0/7.0 1

Status
Not open for further replies.

StumblingThrough

Technical User
Nov 7, 2002
88
US
I've got a automated database that creates a report, writes it to PDF format, and then sends via email using Outlook. Has worked for years (and still works) using Acrobat 5.0. I've got a PC that has Acrobat 7.0, and someting is wrong. Been banging my head on the desk for days now and cannot figure it out. I'm fairly good with VBA, but not as good as I apparently need to be for this. Here is what is happening.

At the step "DoCmd.OpenReport strReportName", a dialog box now appears asking me where I want to save the pdf file. On the PC with Acrobat 5.0 installed, this dialog box does NOT appear, and the report is written to a the path specified in this statement:

SetKeyValue "Software\Adobe\Acrobat PDFWriter", "PDFFilename", strPath, REG_SZ

The above statement (within code which I borrowed and do not completely understand) apparently makes changes to the registry. But for some reason it needs to do something different with Acrobat 6.0/7.0 than it does for earlier versions.

Any ideas / suggestions (other than revert to using Acrobat 5.0)? Thanks in advance!

 
I use 5.0 with Distiller; Under Tools|Distiller|File|Preferences I leave the box "Ask for PDF File Destination" unchecked to suppress the dialog box. Never used 7.o though, and we also use a 3rd party type lib for print automation (from ACG), so the code sample above is unfamiliar. Maybe try posting in the PDF forum if this doesn't work?
Good Luck!

The Microsoft mascot is a butterfly.
A butterfly is a bug.
Think about it....
 
I use similar code to do exactly the same thing. Try inserting this line under the one you show on your post...

SetKeyValue "Software\Adobe\Acrobat PDFWriter", "bExecViewer", 0, REG_SZ

This works for me although I use Acrobat 4
 
Nice try NSNewey. However, after adding that line it failed to send the report to the PDF writer. Here is the new code with that line added.

strOldDefault = QueryKey("Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device")

SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Acrobat PDFWriter", REG_SZ

SetKeyValue "Software\Adobe\Acrobat PDFWriter", "PDFFilename", strPath, REG_SZ

SetKeyValue "Software\Adobe\Acrobat PDFWriter", "bExecViewer", 0, REG_SZ
 
I think I may have found the problem. The above "SetKeyValue" lines call another function containing the following:

lRetVal = RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, KEY_SET_VALUE, hKey)
lRetVal = SetValueEx(hKey, sValueName, lValueType, vValueSetting)


The value for "sKeyName" is "Software\Adobe\Acrobat PDFWriter". I cannot find that key in the registry. Should I try to add it? I am always hesitant to manually edit the registry.
 
Continuing with the above post, the name of my Adobe printer is "Adobe PDFWtiter" (Start>Settings>Priters).

And here are the keys in my registry withing the "Software\Adobe" tree:

Acrobat
Acrobat Distiller
Acrobat Elements
Acrobat Reader
Adobe Acrobat
ALM
Designer

I guess another option is to change the value of sKeyName to "Adobe Acrobat", and rename my printer to the same. What do you think?
 
I have since realised that the line I suggested adding just stops adobe from displaying the resultant PDF file.

Looking at your registry tree, It is clear that your version 7 does not add the same key in the registry as previous versions. I don't think manually adding the key in the registry will work as adobe won't know what it is.

The setKeyValue line adds the PDFFilename key as it is not their by default. You need to add this key but where???

How about locating the key "bExecViewer" then change the path in the SetKeyValue lines to that location. If your registry does not contain this key, version 7 must work differently and I cannot

Hope this helps :)
 
NSNewey,

Believe it or not, that key does not exist, which I believe is not good.

Thanks for trying! :)
 
I have had the same problem using version 4. The code posted here works beautifully, but when you upgrade to 7.0 it fails. They have indeed changed the registry configuration and making any of the above changes does not work. I had to scrap and return to 4.0. I was hoping that someone with more knowledge of Adobe could figure out what to change to make this happen. i use it to export mmulltiple reports consecutively when a department changes in the feeding query to the report.
 
Hi,

I am a VBA beginer and I have the same requirement. Does anyone have solution to print and send report in PDF format? I am using PDF 7.0.

UPSDeveloper, NSNewey, could you post your code on how to do this with PDF 5.0?

Thanks
 
I'm fairly new to automation however, have you tried to post this question on Adobe's site?
 
StumblingThrough .. Any luck finding a solution for this problem. I am having the same exact problem with Adobe 6.0, the save as box keeps poping!

It's Nice to Be Important But It's more Important to BE Nice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top