Results 1 to 12 of 12

Thread: Compile Error: Expected End Sub

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    1

    Question Compile Error: Expected End Sub

    Hi there, this is my first post so apologies in advance for the n00b questions.

    I have a client who is getting this error every time he gets a calendar invite. Im not too familiar with VBS so Im hoping somebody here can make light of this?

    Thank you.

    Name:  VBS.jpg
Views: 2370
Size:  23.5 KB

  2. #2
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Compile Error: Expected End Sub

    SM

    You are missing a line of code

    Code:
    Private Sub CalendarItems_ItemAdd(ByVal Item As Object)
        .. code
        If .. Then
        .. code
        End If
    End Sub
    
    
    Private Sub CalendarItems_ItemChange(ByVal Item As Object)
    
    End Sub
    Spoo

  3. #3
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,832

    Re: Compile Error: Expected End Sub

    Quote Originally Posted by SMunizCC View Post
    Hi there, this is my first post so apologies in advance for the n00b questions.

    I have a client who is getting this error every time he gets a calendar invite. Im not too familiar with VBS so Im hoping somebody here can make light of this?

    Thank you.

    Name:  VBS.jpg
Views: 2370
Size:  23.5 KB
    I don't see how a client can be getting that error...did it actually build with error? In other words you are saying that a client is running your program and getting that error when the error you are showing us would prevent the program from compiling\building. Therefore it seems impossible the client can be getting that error. It is a program development error.
    Last edited by TysonLPrice; Oct 19th, 2017 at 11:44 AM.
    Please remember next time...elections matter!

  4. #4
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Compile Error: Expected End Sub

    Quote Originally Posted by TysonLPrice View Post
    I don't see how a client can be getting that error...did it actually build with error?
    I know what you mean, but OP might not .. maybe you could elaborate

    Spoo

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,522

    Re: Compile Error: Expected End Sub

    It looks like it is an Outlook VBA macro embeded in the CalInvite... or in something that's running on their machine. It's not compiled code. Probably should move this thread to the Office Dev section.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,832

    Re: Compile Error: Expected End Sub

    OK...I stand corrected but:

    How can anything run with a compiler error? Is it something that compiles at run-time like some of the the early third generation languages?
    Please remember next time...elections matter!

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,522

    Re: Compile Error: Expected End Sub

    But it isn't running... it's throwing an error... VBA Macro code files aren't compiled until they are executed, so it's very easy to botch one up, save it and never know until it goes to be executed... the VBA interpreter loads it up, attempts to compile it to run it, and viola! an error happens...

    That's what is happening here. He's got a botched piece of VBA code in an Outlook macro that runs when a calendar invite arrives. When one does, Outlook attempts to run the code, but can't because it's broken.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,832

    Re: Compile Error: Expected End Sub

    "But it isn't running... it's throwing an error"

    Thanks!
    Please remember next time...elections matter!

  9. #9
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Compile Error: Expected End Sub

    Quote Originally Posted by techgnome View Post
    It looks like it is an Outlook VBA macro embeded in the CalInvite... or in something that's running on their machine. It's not compiled code. Probably should move this thread to the Office Dev section.

    -tg
    Good call
    The MsgBox clearly (well, if you squint) is labelled Visual Basic for Applications

  10. #10
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Compile Error: Expected End Sub

    Quote Originally Posted by Spooman View Post
    SM

    You are missing a line of code

    Code:
    Private Sub CalendarItems_ItemAdd(ByVal Item As Object)
        .. code
        If .. Then
        .. code
        End If
    End Sub
    
    
    Private Sub CalendarItems_ItemChange(ByVal Item As Object)
    
    End Sub
    Spoo
    I would have said he had an extra line of code. Remove the "Private Sub CalendarItems_ItemChange(ByVal Item As Object)" line.

  11. #11
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Compile Error: Expected End Sub

    Quote Originally Posted by passel View Post
    I would have said he had an extra line of code. Remove the "Private Sub CalendarItems_ItemChange(ByVal Item As Object)" line.
    And the winner is .....

  12. #12
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Compile Error: Expected End Sub

    Quote Originally Posted by Spooman View Post
    And the winner is .....
    The one with the eagle eyes. I couldn't read a dang thing on that screenshot, not with high confidence anyway
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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