auto_print still doesn't work

  • Thread starter Thread starter Mike Williams
  • Start date Start date
M

Mike Williams

With Powerpoint 2007, in 97-2003 compatibility mode:

I downloaded & installed the autoevents add-in by Shyam Pillai (http://
skp.mvps.org/autoevents.htm). Several of the included demo add-ins
fire properly (auto_open, auto_close). Auto_print, however, (the one
I need) doesn't. Any thoughts what I might be doing wrong? THANKS.
 
Mike,
I'll take a look at it later today. I haven't done an update for PPT 2007 so
I will what's up with it.

Regards,
Shyam Pillai
 
I'd post the relevant code here as a start.
in module 1:
Option Explicit
' Sample demo of auto macros supported by the AutoEvents add-in for
PowerPoint 2000.
'[some procedures have been deleted]
'[the first two fire as expected]
Sub Auto_open()
MsgBox "You just opened the presentation."
End Sub

Sub Auto_Close()
MsgBox "You are closing the presentation."
End Sub

'[this one doesn't]
Sub Auto_Print()
MsgBox "You are about to print"
End Sub

in module 2:
Sub _
Auto_open()
Debug.Print " This is the second one"
End Sub

in Class Modules, clsCBEvents

Public WithEvents colCBars As Office.CommandBars
Public WithEvents CtrlHandler As Master

Private Sub colCBars_OnUpdate()
Static PreCopy As Integer
Dim MacroName As String
Dim PresName As String
Select Case PreCopy
Case Is > Presentations.Count
PreCopy = Presentations.Count
If PreCopy = 0 Then Exit Sub
Case Is < Presentations.Count
PreCopy = Presentations.Count
If PreCopy = 0 Then Exit Sub
If fnThisVBComponent(Presentations(PreCopy), "Auto_Open") <> ""
Then
MsgBox "You have a autoopen macro in ur document. Do you wish
to execute?", vbYesNo + vbQuestion, "Run Auto Open"
MacroName = Presentations(PreCopy).Name & "!" &
fnThisVBComponent(Presentations(PreCopy), "Auto_Open") & ".Auto_Open"
Application.Run MacroName
End If
Case Is = Presentations.Count
PreCopy = Presentations.Count
If PreCopy = 0 Then Exit Sub
If PreCopy = 1 Then
End If
End Select
End Sub

Function fnThisVBComponent(oBk As Presentation, sUniqueString As
String) As String
Dim oVBC As VBComponent
'Loop through the VBComponents in the given workbook's VBProject
For Each oVBC In oBk.VBProject.VBComponents
'Using it's code module
With oVBC.CodeModule
'See if we can find the unique string
If .Find(sUniqueString, 1, 1, .CountOfLines, 1000, True, True,
False) Then
'Found it, so return the VBComponent where it was found
Debug.Print oVBC.Name
If oVBC.Type = vbext_ct_StdModule Then
fnThisVBComponent = oVBC.Name
Exit For
End If
End If
End With
Next

End Function
 
Works in 2007 here Mike

John

Mike Williams said:
I'd post the relevant code here as a start.

in module 1:
Option Explicit
' Sample demo of auto macros supported by the AutoEvents add-in for
PowerPoint 2000.
'[some procedures have been deleted]
'[the first two fire as expected]
Sub Auto_open()
MsgBox "You just opened the presentation."
End Sub

Sub Auto_Close()
MsgBox "You are closing the presentation."
End Sub

'[this one doesn't]
Sub Auto_Print()
MsgBox "You are about to print"
End Sub

in module 2:
Sub _
Auto_open()
Debug.Print " This is the second one"
End Sub

in Class Modules, clsCBEvents

Public WithEvents colCBars As Office.CommandBars
Public WithEvents CtrlHandler As Master

Private Sub colCBars_OnUpdate()
Static PreCopy As Integer
Dim MacroName As String
Dim PresName As String
Select Case PreCopy
Case Is > Presentations.Count
PreCopy = Presentations.Count
If PreCopy = 0 Then Exit Sub
Case Is < Presentations.Count
PreCopy = Presentations.Count
If PreCopy = 0 Then Exit Sub
If fnThisVBComponent(Presentations(PreCopy), "Auto_Open") <> ""
Then
MsgBox "You have a autoopen macro in ur document. Do you wish
to execute?", vbYesNo + vbQuestion, "Run Auto Open"
MacroName = Presentations(PreCopy).Name & "!" &
fnThisVBComponent(Presentations(PreCopy), "Auto_Open") & ".Auto_Open"
Application.Run MacroName
End If
Case Is = Presentations.Count
PreCopy = Presentations.Count
If PreCopy = 0 Then Exit Sub
If PreCopy = 1 Then
End If
End Select
End Sub

Function fnThisVBComponent(oBk As Presentation, sUniqueString As
String) As String
Dim oVBC As VBComponent
'Loop through the VBComponents in the given workbook's VBProject
For Each oVBC In oBk.VBProject.VBComponents
'Using it's code module
With oVBC.CodeModule
'See if we can find the unique string
If .Find(sUniqueString, 1, 1, .CountOfLines, 1000, True, True,
False) Then
'Found it, so return the VBComponent where it was found
Debug.Print oVBC.Name
If oVBC.Type = vbext_ct_StdModule Then
fnThisVBComponent = oVBC.Name
Exit For
End If
End If
End With
Next

End Function

__________ Information from ESET Smart Security, version of virus
signature database 5002 (20100405) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 5002 (20100405) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Wonder if compatibility mode is the problem.  Hmmmm.

update: tried with new file, 2007 mode; still doesn't work.
did you actually print, and get auto_print to run, i.e. this line
fires?

MsgBox "You are about to print"

because that just doesn't happen for me.
 
Back
Top