Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel sheet to PDF Macro = security question
All,
I found this piece of code on the group: Sub PrintPDF() Dim PSFileName As String Dim PDFFileName As String PSFileName = "D:\MyDoc.PS" PDFFileName = "D:\MyDoc.pdf" ' Print the Excel range to the postscript file Dim MySheet As Worksheet Set MySheet = ActiveSheet MySheet.PrintOut copies:=1, preview:=False, _ ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, _ prtofilename:=PSFileName ' Convert the postscript file to .pdf Dim myPDF As PdfDistiller Set myPDF = New PdfDistiller myPDF.FileToPDF PSFileName, PDFFileName, "" End Sub This runs fine under Admin permissions. BUt does not under a users. I have granted full read / write access to the folder where Adobe sits, but with no luck. Can someone tell me how the distiller works and what permissions the user would need to execute this? Doug |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel sheet to PDF Macro = security question
do you have distiller defined as a printer under the ID that fails?
If so, select it manually. then in the immediate window in the VBE do ? Application.ActivePrinter and see what the string is. Does it match your code? -- Regards, Tom Ogilvy " wrote: All, I found this piece of code on the group: Sub PrintPDF() Dim PSFileName As String Dim PDFFileName As String PSFileName = "D:\MyDoc.PS" PDFFileName = "D:\MyDoc.pdf" ' Print the Excel range to the postscript file Dim MySheet As Worksheet Set MySheet = ActiveSheet MySheet.PrintOut copies:=1, preview:=False, _ ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, _ prtofilename:=PSFileName ' Convert the postscript file to .pdf Dim myPDF As PdfDistiller Set myPDF = New PdfDistiller myPDF.FileToPDF PSFileName, PDFFileName, "" End Sub This runs fine under Admin permissions. BUt does not under a users. I have granted full read / write access to the folder where Adobe sits, but with no luck. Can someone tell me how the distiller works and what permissions the user would need to execute this? Doug |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel sheet to PDF Macro = security question
Tom,
I do not have that set up. But I dont see how I would set the distiller as a printer. Waht I have is the Adobe PDF as a printer (and my bad for not posting the one I am working with) is ActivePrinter:="Adobe PDF on Ne01:" This is in my print list. But the code fails on the lines Dim myPDF As PdfDistiller Set myPDF = New PdfDistiller If I am not in an admin setting. Do I need to set up something for the distiller? Doug Tom Ogilvy wrote: do you have distiller defined as a printer under the ID that fails? If so, select it manually. then in the immediate window in the VBE do ? Application.ActivePrinter and see what the string is. Does it match your code? -- Regards, Tom Ogilvy " wrote: All, I found this piece of code on the group: Sub PrintPDF() Dim PSFileName As String Dim PDFFileName As String PSFileName = "D:\MyDoc.PS" PDFFileName = "D:\MyDoc.pdf" ' Print the Excel range to the postscript file Dim MySheet As Worksheet Set MySheet = ActiveSheet MySheet.PrintOut copies:=1, preview:=False, _ ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, _ prtofilename:=PSFileName ' Convert the postscript file to .pdf Dim myPDF As PdfDistiller Set myPDF = New PdfDistiller myPDF.FileToPDF PSFileName, PDFFileName, "" End Sub This runs fine under Admin permissions. BUt does not under a users. I have granted full read / write access to the folder where Adobe sits, but with no luck. Can someone tell me how the distiller works and what permissions the user would need to execute this? Doug |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel sheet to PDF Macro = security question
to me, that means Adobe PDF is not registered under that User ID (it isn't
in that user ID's registry entries). You would need to use regsvr32.exe to register it. If you put up broken code and say it works, then ask why it doesn't work somewhere else, your not helping yourself. -- Regards, Tom Ogilvy |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel sheet to PDF Macro = security question
Thought I would post a follow up for my issue.
It ends up the issue was my machine was trying to access HKEY_CLASSES_ROOT\APPID It wanted full access to the key (it did not write anything to the Regestry) So for those who end up with the error message of "Active X can't create object" You need full access to this key in order for the macro to work. (Admins will have no issue) Hope these helps some folks Doug |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
2007 question - Macro Security | Excel Discussion (Misc queries) | |||
Very Novice Excel user with security question | Excel Discussion (Misc queries) | |||
How turn off macro security question for workbook with no marcos? | Excel Discussion (Misc queries) | |||
Macro security question | Excel Programming | |||
I got an Excel Macro/Security question that is driving me nuts..... | Excel Programming |