Results 1 to 5 of 5

Thread: [RESOLVED] Fax events in VBA

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    3

    Resolved [RESOLVED] Fax events in VBA

    Hi,
    I've a problem to work with Fax events in VBA. I want to run a procedure when the 'OnOutgoingMessageAdded' event is triggered. The code is following:


    Option Explicit
    Dim WithEvents oFS As FAXCOMEXLib.FaxServer

    Private Sub Application_Startup()

    Set oFS = New FAXCOMEXLib.FaxServer

    End Sub

    Sub oFS_OnOutgoingMessageAdded(Fserver As FAXCOMEXLib.FaxServer, MsgId As String)
    ' the event handler
    End Sub

    and the error I get in the last procedure definition is:
    Procedure declaration does not match description of event or procedure having same name


    I appreciate any help.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Fax events in VBA

    Welcome to the forums.

    Typically that error message means you have to procedures (Subs or Functions or whatever) with the exact same name and VB does not know how to deal with that.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    3

    Re: Fax events in VBA

    Hi,
    Thanks for your time.
    The issue is that the Sub oFS_OnOutgoingMessageAdded() is not duplicated anywhere else in my code. It's unique. As soon as I rename it, the error disappears. It seems that when I instantiate the FaxServer object, this sub conflicts with something. If I rename this sub, then the event does not trigger. Does anybody has a better idea to use this event?

    Thanks.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Fax events in VBA

    did you create the sub?

    the sub is an event of fax server and is created automatically when you declare with events even if there is no sub of that name. if you find the drop down box for the code pane where you declare with events you can find the events of the fax server created
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    3

    Re: Fax events in VBA

    Hi,
    Thanks for all your comments.
    I found the final solution here:

    http://msdn.microsoft.com/en-us/libr...13(VS.85).aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width