Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBA Events and WithEvents

VBA Events and WithEvents

VBA Events and WithEvents

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
        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 "Event" nor "RaiseEvent".

It will accept "WithEvents" 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.



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close