Qry Resolved:setting password to a powerpoint file using Visual basic
hi there
i m facing a prblm while setting password to a powerpoint file from my visual
basic appln.
Through my vb application i create an object of ms powerpoint.
using this object i open a required powerpoint file
then using the password property i assign password to that
powerpoint file and save tht file
but when i open tht file it does not ask me for the password that i
had set from my vb application
The code that i m using is as follows:
Dim oPPTApp As PowerPoint.Application
Dim oPPTPres As PowerPoint.Presentation
Dim sPresentationFile As String
sPresentationFile = strSource
' Get a reference to PowerPoint app
Set oPPTApp = New PowerPoint.Application
' MUST set it visible or you get errors
oPPTApp.Visible = True
' minimize if you want to hide it:
oPPTApp.WindowState = ppWindowMinimized
' Open our source PPT file, get a reference to it
Set oPPTPres = oPPTApp.Presentations.Open(sPresentationFile)
'oPPTApp.ActivePresentation.Password = Trim(txtPassword)
' oPPTPres.Application.ActivePresentation.Password = Trim(txtPassword)
'oPPTPres.Password = Trim(txtPassword)
oPPTApp.Presentations.Application.ActivePresentation.Password = Trim(txtPassword)
' Cleanup
' Close the presentation
oPPTPres.Close
' Quit PPT
oPPTApp.Quit
' Release variables
Set oPPTPres = Nothing
Set oPPTApp = Nothing
please send me some piece of code that will associate the password i pass
from my vb application to the powerpoint file
thanks and regds
paresh surve
Re: setting password to a powerpoint file using Visual basic
I think you need to save it after you assign a password. I can't be sure if this is where you read or try to save. I assume that it is where you try to save it (but don't)
Re: setting password to a powerpoint file using Visual basic
Quote:
Originally Posted by dglienna
I think you need to save it after you assign a password. I can't be sure if this is where you read or try to save. I assume that it is where you try to save it (but don't)
thanks david
your suggesstion of saving the file after assigning the password
has worked
thanks and regds
paresh
Re: setting password to a powerpoint file using Visual basic
Glad to help. I struggled all day with nobody helping, and it would have solved a lot of grief had someone suggested the solution.
Do us a favor, and,
Add the Checkmark and the word [RESOLVED] to the subject of the first post in your thread
if your question has been answered satisfactorily.