|
-
Jan 7th, 2005, 02:43 AM
#1
Thread Starter
New Member
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
Last edited by paresh.surve; Jan 7th, 2005 at 05:34 AM.
Reason: qry Resolved
-
Jan 7th, 2005, 02:50 AM
#2
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)
-
Jan 7th, 2005, 03:58 AM
#3
Thread Starter
New Member
Re: setting password to a powerpoint file using Visual basic
 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
-
Jan 7th, 2005, 04:48 AM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|