D
djerinic
I woud like to open password protected PPT from vb6. I found code (see
below) that run in PPT (code is saved as macro and I started macro),
but doesn't work if I place it in VB module. Can anybody help me!
Thanks, Dak
Code:
Option Explicit
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As
Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
Public TimerID As Long
Public sPwd As String
Sub OpenPassPres()
Dim objPPT As PowerPoint.Application
Dim objPres As PowerPoint.Presentation
Set objPPT = New PowerPoint.Application
objPPT.Visible = msoTrue
TimerID = SetTimer(0, 0, 2000, AddressOf PassProc)
' Replace with your password
sPwd = "q"
' Replace C:\Test.ppt with your path to presentation
Call Presentations.Open("C:\Test.ppt")
End Sub
Sub PassProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal idEvent As Long, _
ByVal dwTime As Long)
TimerID = KillTimer(0, TimerID)
SendKeys sPwd & "~"
End Sub
below) that run in PPT (code is saved as macro and I started macro),
but doesn't work if I place it in VB module. Can anybody help me!
Thanks, Dak
Code:
Option Explicit
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As
Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
Public TimerID As Long
Public sPwd As String
Sub OpenPassPres()
Dim objPPT As PowerPoint.Application
Dim objPres As PowerPoint.Presentation
Set objPPT = New PowerPoint.Application
objPPT.Visible = msoTrue
TimerID = SetTimer(0, 0, 2000, AddressOf PassProc)
' Replace with your password
sPwd = "q"
' Replace C:\Test.ppt with your path to presentation
Call Presentations.Open("C:\Test.ppt")
End Sub
Sub PassProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal idEvent As Long, _
ByVal dwTime As Long)
TimerID = KillTimer(0, TimerID)
SendKeys sPwd & "~"
End Sub