Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 question - Macro Security Otto Moehrbach Excel Discussion (Misc queries) 2 October 28th 07 07:40 PM
Very Novice Excel user with security question Ralph Malph Excel Discussion (Misc queries) 5 March 23rd 06 06:33 PM
How turn off macro security question for workbook with no marcos? Dewy Cheatum & Howe Excel Discussion (Misc queries) 2 December 9th 05 10:14 PM
Macro security question Daniel Bonallack[_2_] Excel Programming 6 January 6th 04 10:10 PM
I got an Excel Macro/Security question that is driving me nuts..... Jon[_9_] Excel Programming 11 August 11th 03 01:51 AM


All times are GMT +1. The time now is 01:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"