+ Reply to Thread
Results 1 to 4 of 4

Error code on vbokcancel

  1. #1
    Registered User
    Join Date
    11-08-2013
    Location
    Clarkston Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Error code on vbokcancel

    I'm getting a request to debug when I click cancel on my msgbox. This is how it's coded:

    bytAns = MsgBox("Proceed only if there are no open workbooks titled 'Book 1' and you've completed all other steps", vbOKCancel,)
    If bytAns = vbCancel Then DoCmd.CloseSub

    Any suggestions?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error code on vbokcancel

    What is the comma after vbOKCancel,) ?

    Do you mean ", vbOKCancel,vbCancel)?

  3. #3
    Registered User
    Join Date
    11-08-2013
    Location
    Clarkston Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Error code on vbokcancel

    Not sure lol. It didn't seem to be hurting anything. I did remove it, the highlighted field in the debugger is the "do command" argument.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Error code on vbokcancel

    DoCmd is an Access object. Is it declared and initialized?
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Where to insert value writer within a vbOKCancel procedure?
    By 2Excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-27-2011, 12:50 PM
  2. MSbox query RE VBOkCancel
    By AppSupportKarl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2011, 08:16 AM
  3. Help using msgbox vbokcancel
    By tanktata in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2011, 10:26 AM
  4. Breaking a Sub with vbOKCancel...
    By firefiend in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-01-2007, 12:27 PM
  5. [SOLVED] vbOKCancel box to close
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2006, 05:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1