PDA

View Full Version : Macro to print slides is not working in read-only mode



dugdowndeep
09-23-2010, 08:21 AM
I have a macro that runs when you click on a text field on the first slide of a ppt file. The problem is that when you open the password-protected ppt in read-only mode, the macro is not running. When you open it in edit mode by entering the password, it runs just fine. This used to work but recently stopped working (or recently we noticed it stopped working).

Any ideas on how to fix the problem?

Here is the macro code we're using:
Sub PrintNotes()
'
' Macro recorded 1/25/2010
'

With ActivePresentation.PrintOptions
.RangeType = ppPrintAll
.NumberOfCopies = 1
.Collate = msoTrue
.OutputType = ppPrintOutputNotesPages
.PrintHiddenSlides = msoTrue
.PrintColorType = ppPrintColor
.FitToPage = msoFalse
.FrameSlides = msoFalse
End With
ActivePresentation.PrintOut
End Sub

John Wilson
09-23-2010, 09:54 AM
If you attempt to modify the print options then you are modifying the presentation. I'd be very surprized if it ever worked in read only mode.

try setting the options in Options> Advanced >Print Options to notes etc before saving the presentation as password protected and then just use
Sub PrintNotes()
ActivePresentation.PrintOut End Sub

dugdowndeep
09-23-2010, 11:23 AM
I will try that and let you know how it works out. Thanks.

I did come across a MS kb article about a problem printing protected files that was solved after Office SP2. Since we have SP1 still, I was thinking that was the cause.

dugdowndeep
09-23-2010, 11:35 AM
I tried it. I remember now why we did more than just a simple printout. We need it to print with notes, so at least the OutputType property has to be set.

Also, there is the annoying problem of PP popping up a Do you want to save changes? dialog, even with the simple version of the macro you supplied. Thanks for the idea, and it worked somewhat, but something tells me this isn't going to work the way we hoped.

John Wilson
09-24-2010, 05:17 AM
Did you try manually changing the print options to Notes before saving.

This is done in options>Print>When printing this document use .....

I have 2007 SP2 and your code doesn't work here

Paul_Hossler
09-24-2010, 08:15 AM
Could you FileSaveAs a non-RO copy to TEMP, print that one from your original, and finally delete the copy?

Paul

John Wilson
09-24-2010, 08:18 AM
Don't think you can saveas passworded files

Paul_Hossler
09-25-2010, 08:44 AM
John,

Yep, I was thinking of the RO file, and forgot the PW part

Paul

dugdowndeep
09-25-2010, 09:01 AM
Paul, this is intended as an end-user macro, so that it is easy to print the presentation with a macro. So we can find workarounds, but it defeats the purpose. Thanks.

John, I have not tried that. I will, and will post the results. Thanks.

dugdowndeep
10-05-2010, 09:04 AM
Awesome. It worked, John. Thanks!

Is there any way to suppress the "Do you want to save..." dialog that pops up, though? That kind of defeats the purpose of password protecting it in the first place.

Cosmo
10-05-2010, 09:48 AM
You can set the 'Saved' property to true to prevent the program from asking if you want to save any changes when you close the file.
ActivePresentation.Saved = True

dugdowndeep
10-05-2010, 10:38 AM
You say it will prevent the save dialog when you close, but the popup occurs immediately after the macro runs. (See post 2 for the macro.) Can I just add it to that macro and get the same result?


eta: I just tried adding that to the macro. I still get the popup.

Cosmo
10-05-2010, 10:59 AM
You say it will prevent the save dialog when you close, but the popup occurs immediately after the macro runs. (See post 2 for the macro.) Can I just add it to that macro and get the same result?


eta: I just tried adding that to the macro. I still get the popup.
I'm sorry, I thought the message was coming up when you were closing the file, didn't realize it comes up when trying to alter the file, if that's the case.

dugdowndeep
10-05-2010, 12:45 PM
Thanks anyway. Yeah, it happens immediately after the macro in post 2 runs.