JeffP@Laptop
2006-10-25 18:25:57 UTC
I'm having a problem implementing this programming...
ref: http://word.mvps.org/faqs/macrosvba/pseudoautomacros.htm
Word2000
I have added to my existing "ADOTemplate" module the code
Option Explicit
Dim oAppClass As New ThisApplication
Public oldNoOfOpenDocs As Long
Public FirstNewDoc As Boolean
Public Sub AutoExec()
Set oAppClass.oApp = Word.Application
oldNoOfOpenDocs = 0
FirstNewDoc = True
End Sub
I added a class module "ThisApplication" with....
Option Explicit
Public WithEvents oApp As Word.Application
---------------------------------------------------------------------
Private Sub oApp_DocumentChange()
On Error GoTo ExitCode
Dim newNoOfOpenDocs As Long
.......ending....
Call DocChangedFocus
End If
Exit Sub
ExitCode:
End Sub
Q1: Should the oApp_DocumentChange() be in my "ADOTemplate" module or the
ThisApp class module ?
Q2: Should the oApp_DocumentOpen() be in the "ThisDocument" class module?
Q2b: How does the Doc in "oApp_DocumentOpen(ByVal Doc as Document)" get
passed in, looking at the code it appears that it's implied?
TIA
JeffP...
ref: http://word.mvps.org/faqs/macrosvba/pseudoautomacros.htm
Word2000
I have added to my existing "ADOTemplate" module the code
Option Explicit
Dim oAppClass As New ThisApplication
Public oldNoOfOpenDocs As Long
Public FirstNewDoc As Boolean
Public Sub AutoExec()
Set oAppClass.oApp = Word.Application
oldNoOfOpenDocs = 0
FirstNewDoc = True
End Sub
I added a class module "ThisApplication" with....
Option Explicit
Public WithEvents oApp As Word.Application
---------------------------------------------------------------------
Private Sub oApp_DocumentChange()
On Error GoTo ExitCode
Dim newNoOfOpenDocs As Long
.......ending....
Call DocChangedFocus
End If
Exit Sub
ExitCode:
End Sub
Q1: Should the oApp_DocumentChange() be in my "ADOTemplate" module or the
ThisApp class module ?
Q2: Should the oApp_DocumentOpen() be in the "ThisDocument" class module?
Q2b: How does the Doc in "oApp_DocumentOpen(ByVal Doc as Document)" get
passed in, looking at the code it appears that it's implied?
TIA
JeffP...