Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Events and WithEvents

Status
Not open for further replies.

vbaprogammer

Programmer
Sep 16, 1999
59
US
I have written the following code in a form and in a class module (actually I got help from the internet). It works fine in VBA 6.0 (Word 2000), but will not work in VBA 5.0 (Word 97) -- it actually was written for VB.

I am writing an automation document with Word and need my new programming in Word 2000 to work in Word 97.

Here's the code. All I need is a translation from VBA 6.0 "event" to something that will work in VBA 5.0.
==========
This is the 6.0 code -- In Class Module (CWizard):
--------------
Option Explicit
Public Event Validate(ByRef CancelMove As Boolean)
Public Event DisplayStep()
Public Event Finish()

Private m_Step As Integer
Private m_StepCount As Integer

Public Property Get Step() As Integer
Step = m_Step
End Property

Public Property Let Step(nStep As Integer)
If nStep < 0 Or nStep >= m_StepCount Then
Exit Property
Else
m_Step = nStep
RaiseEvent DisplayStep
End If
End Property

[More code]
=========
6.0 In Form (frmMain):
-----------
Private WithEvents m_Wizard As CWizard

Dim SectionStart As Integer
Dim SectionEnd As Integer
\\\\\\\\\\\\\\\\\\\
VBA 5.0 (W97) doesn't like &quot;Event&quot; nor &quot;RaiseEvent&quot;.

It will accept &quot;WithEvents&quot; in the Class Module, but I can't get the syntax correct and other things break.

I'd be happy to provide more info, if necessary.

Appreciate the help.

Thanks,

Dan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top