MAC VBA Code workbook close only works when breakpoints are set - fails when no breakpoints

We have an Excel Product that we are trying to get to work on the Mac.  One of the worksheets displays a disclaimer, and if the user clicks on the I Don't Accept radio button and then clicks next, the workbook is supposed to close itself.  The
code is quite simple:
Public Sub HandleNextButton()
    Dim filename As String
    Dim opened_workbook As Workbook
    If AcceptsDisclaimerChecked Then
        FinishSetup
    Else
         ThisWorkbook.Saved = True ' Realize this is redundant based on false on the next line.
         ThisWorkbook.Close False
      End If
End Sub
All of our product sheets are protected by a block of code attached to the Workbook_BeforeClose event:
 Only allow a save if privileged, otherwise mark the workbook as saved
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    On Error Resume Next
    If ThisWorkbook.Saved Then Exit Sub
    ' If this user is not allowed to save, then cancel the save
    CM_Settings = LoadRegistrySettings
    If (CM_Settings And 4096) = 0 Then
        Me.Saved = True
    Else
       ' If the workbook is saveable, then turn on the image to protect the data.
       ' saving the workbook triggers the Workbook_BeforeSave which shows the veil
       Me.Save
    End If
End Sub
This works fine on the PC.  On the Mac, the workbook does not close.  I can see the button fire, and when it gets to the point where the workbook is to be closed, nothing happens.
 However, when I put a break point on the first line of the Workbook_BeforeClose, I can briefly see it reach the breakpoint (the line turns yellow), and then the workbook immediately closes.  A breakpoint anywhere in this routine causes the same
behaviour, the close works correctly.  No breakpoint, no close.  Commenting out the Resume Next has no effect.  The only thing that will cause the work book to close, is to put a break point on on the On Error Resume Next in the code.  If
the workbook.Saved=True is commented out, the Workbook_Close code will exit, at the first if statement, but the workbook will not close.
Does anyone have any clues to this bizarre behaviour?
Thanks, Neil
Neil M. Johnson

There is a difference between MAC and Windows based VBA code. I'd suggest asking MAC related questions on the
Office for Mac  forum instead. The current forum is for Windows based developers.

Similar Messages

  • My iCloud only works on my iPhone/ipod/ipad when my Mac is on...what did I do wrong?

    My iCloud only works on my iPhone/ipod/ipad when my Mac is on...what did I do wrong?

    It's a brand new MacBook Air.....10.7.4 I think....

  • Hello Everyone,      I have a MacBook older model with me.I am running 10.7.6 on that, I was trying to use BootCamp to install windows on my mac. Since BootCamp can only work on a single Volume, I partitioned my Hard Disk to one volume.   Using BootCamp I

    Hello Everyone,
              I have a MacBook older model with me.I am running 10.7.6 on that, I was trying to use BootCamp to install windows on my mac. Since BootCamp can only work on a single Volume, I partitioned my Hard Disk to one volume.
    Using BootCamp I installed windows and everything worked fine. After installing windows and testing everything, I switched back to OS X and this time I tried to make another partition on my single portioned Mac volume and named it Backup. That too worked. Now I have three Volumes
    1)Development2)Backup3)BootCamp.
    Next when I switched to Windows, It should the classic error, No Bootable device found, please insert a Bootable CD and press any key. When I tried to enter my Mac OS X install DVD and by pressing option key, it does not show me the proper Mac OS X development volume. It keeps going back to the No bootable device found message.
    Any help will be much appreciated
    Regards
    Mithun

    you can't add a partition in between - you put Windows to a new partition number.
    GPT (GUID)
    EFI
    Mac HFS
    Lion Recovery
    Windows
    And now you have two HFS
    One partition and one Windows (plus Lion Recovery).
    If you were to have more, it can't be before Windows for one thing.

  • My iPhone 5c sound/speaker only works with the headphones in and when I'm trying to change a ringtone in settings..

    my iPhone 5c sound/speaker only works with the headphones in and when I'm trying to change a ringtone in settings.. why is this?! its not on airplane mode, its not on silent, ive tried turning it on and off, software is up-to-date etc. just no sound for text alerts or when trying to play music/videos. Help!

    same issue as this guy it's a hardware issue
    https://discussions.apple.com/thread/6266690?tstart=0

  • My ipad safari and mail are not working. Why are they blank when I clickclick on them?

    My ipad safari and mail are not working.  Why are they blank when I

    For Safari try clearing it's cache : Settings > Safari > Clear Cache (and Clear History).
    You could also try closing the two apps completely : from the home screen (i.e. not with Safari or Mail 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail and Safari apps to close them, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • SSIS package works in development environment but fails when job scheduler executes, file path invalid

    SIS package works in development environment but fails when job scheduler executes, file path invalid
    Relatively simple package to get OLE-DB connection to MS FoxPro 9.0 DB
    The failure in the job log states that the path is invalid its a network path (\\192.168.1.xxx\foldername) this has been run several ways with the remote computer being mapped as a network drive and through the \\ notation described above.
    Thinking it was a security issue between the SQL agent account and my account I tested by subsitution myself as a proxy account for the agent when running this job, again same result failed on network path.
    One issue I see is that the remote computer is running Server 2000 (legacy software incompatable with newer versions) 
    Is it possible that this is a security issue, since if i understand correctly the current MS domain security model didn't exist until Server 2003.

    Hi REIData,
    Have you got the issue resolved? Based on your description, please make sure the target folder is shared properly. If the computer on which the SQL Server Agent job runs doesn’t join the domain as the server that hosts the shared folder, you have to share
    the folder with everyone by adding “Everyone” to the people list on the File Sharing page of the folder and assign "Read/Write" permission to it.
    Regards,
    Mike Yin
    TechNet Community Support

  • I can record and hear me recording through the computer's built in mic, but can't get the external mic and headphones to work., The preferences are set for the external mic and headphones...

    I can record and hear me recording through the computer's built in mic, but can't get the external mic and headphones to work., The preferences are set for the external mic and headphones...

    What operating system are you using? Is it on a Mac or a PC? Which preferences are set for external mic/headphones, Audition's or the computers?

  • I have two iPads; mine and my daughters. One Apple ID one email. Can I FaceTime her when we are set up that way?

    I have two iPads; mine and my daughters. One Apple ID one email. Can I FaceTime her when we are set up that way?

    This might be helpful for you. It explains how to use additional email messages so that you can FaceTime and Message with each other even while sharing the one Apple ID.
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    Before my wife, daughter and I all bought iPhones, we used this method with great success. I have 4 iOS devices myself and still use email addresses on two of them for FaceTime on two of them.

  • Nano only works via mains charger then freezes when unplugged....

    Could use someones wise advice please!
    My nano is just over 1yr old, worked fine until recently. I have tried the 5 r's, software is upto date, battery is fully charged, only works via mains charger but when i disconnect it, it freezes with a line through the screen. Connect it to charger, it is fine again.
    Via pc usb, the apple logo comes on then it goes black then logo then black screen etc seems it almost boots up but just quite doesnt.
    I have found if you hold ccentre button & left scroll button you access an engineers menu, been through all this and it seems fine. Any help would be cool

    If the iPod functions normally while plugged into an external power source of some sort (either USB port on your PC or Mac OR while plugged into a wall adapter), but doesn't when running on battery power, it's likely that the iPod's battery is shot.
    You can have Apple or a third party repair center replace the battery for a flat fee. Otherwise, it's time to start saving for a new iPod or replacement.
    B-rock

  • VBA- Code behind button not working

    I am trying to add a vba code behind a close button to close a form but error keeps coming up. Each time i click the close button a Compile Error message: Sub or Function not Defined, keeps on coming up. 
    Code is below
    Private Sub cmdClose_Click()
    On Error GoTo Err_cmdClose_Click
    ' If Me.Dirty Then Me.Dirty = False
    DoCmd.Close
    Exit_cmdClose_Click:
        Exit Sub
    Err_cmdClose_Click
    MsgBox Err.Description
        Resume Exit_cmdClose_Click
    End Sub

    Sometimes the link between the button and its event gets broken. Select the button on the form in design view. Select the On Click event in the properties sheet. Then press F7. That usually fixes it.
    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

  • Cache, cookies and history are not clearing when I close Firefox even though they are set to do so and have been for ages

    I recently had an update (or upgrade?) for FF 16. Today (and I believe the update was done a day or two ago?) my cache, cookies and history are not clearing when I close FF. Also, certain links are not working. Not links for full web pages but for site pop-ups (like the smilie window on a message board). They worked a few days but are not working today. I click the link and nothing happens. I noticed the problem with the cookies not clearing for a few weeks ago but it was only on one site not all sites which is what's happening now.
    My apologies if that's a little confusing. Thanks!

    At any rate, have you tried running Firefox in Private Browsing mode? This will ensure that no infromation from your session is saved once you exit Private Browsing mode and/or exit Firefox.
    You can set Firefox to always start in Private Browsing mode: https://support.mozilla.org/en-US/kb/private-browsing-browse-web-without-saving-info#w_how-do-i-always-start-firefox-in-private-browsing

  • Hyperlinks not working once uploaded when they are set up in iweb

    Hi there
    I have spent hours trying to crack this. I have designed my new website in iweb09 and triple checked all my hyperlinks are set up which they are. However, when I upload the site to my FTP via Cyberduck only a few of them work. I have also tried to preview it on a PC where more seem to work.
    How can I resolve this problem its driving me crazy. I'd appreciate any advice you lot have on this.
    My site address is www.sevendaysdesign.co.uk you will see its currently sitting like one flat image but some of these links on the home page have worked on previous uploads but I have never got them all working.
    Thanks
    Nikki
    Message was edited by: sevendaysdesign

    An iWeb page has 4 layers :
    1. A Navigation layer
    2. A Header layer
    3. A Body layer
    4. A Footer layer.
    The names tell you what their purpose is.
    The layers have z-index numbers.
    I don't know how you managed it, but it appears that all your content is in the nav-layer.
    And the Body layer is blocking the top part.
    The Footer layer, which is below the Body-layer, covers the bottom part of the nav-layer.
    Do Command-Shift-L to see it.
    Put content where it belongs. And make sure nothing covers other content.

  • Mail being deleted when preferences are set otherwise

    Hi, I run a late-2013 27-inch iMac with with OSX10.9.3. Although all my Mail preferences are set to 'never delete', periodically my entire Inbox and Sent folders get completely emptied out, every email deleted. The many emails I have in folders are untouched. I need to refer often to my sent mail and this is causing large problems as you'd imagine - as is losing my Inbox contents before I've dealt with them all. Anyone else experiencing this? Know how to avoid it? Thanks!

    Yes, good question. I have several gmail accounts for my business (accounts, enquiries, mine etc). I'm not at all technically-minded when it comes to Mail accounts, if it helps with the diagnosis my incoming mail server is imap.gmail.com

  • Since version 20 tabs don't close. Works fine on older version. When will this be fixed?

    Since version 20 when I close a tab after some time tabs don't close and you can't even switch to the closed tab. Which seems to indicate that webpage has close but tab bar has not removed the page entry. This means that tab bar gets filled with old tabs quickly. Only way to recover is to close Firefox and restart. This is very annyoing and forcing me to switch to other browsers. Same problem doesn't happen on older version.
    Due to this I have right now downgraded to version 15. But our IT will automatically upgrade to latest version very soon.

    hello, can you try to replicate this behaviour when you launch firefox in safe mode once? if not, maybe an addon is interfering here...
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]

  • Installed a wireless canon Pixma MX432 printer back in November for use with my Mac Book Air. All was working normally until this past week when I began getting a message, "printer not connected." What is going on? Netgear Wireless N Router seems to be ok

    My new canon Pixma MX432 printer is not printing. It was printing fine until about ten days ago. I use a Netgear Wireless N router, which is also new. What do I need to do. I get a message when trying to print that says "printer not connected." In addition, my old Gateway laptop will still print fine apparently because it has a cable connection to the printer. Puzzled!

    Have you tried rebooting the router? I would unplug it, wait a few seconds, then plug it back in. Be sure you know the password etc. if that doesn't work, try unplugging and rebooting the printer. Good luck!

Maybe you are looking for

  • I have setup JSP & MySQL but how can i Connect it to eche other ?

    I feel sory by asking this qustion but i tried very enough 100 mile start from 1 mile ^_^ I have tested JSP files by http://localhost:8080/test.jsp and it works very will also i have already installd MySQL and i can create databases and tables by htt

  • Outlook and iPhone Calendar Sync Issue

    I'm having an issue where any meeting on my Outlook calendar that is after 3AM and spans multiple days (i.e meeting is from Sunday 4AM to Monday 6PM) it actually shows up on my phone as being Monday-Tuesday instead of Sunday-Monday. Has anyone else s

  • HP Color LaserJet CM2320nf

    I have OS X 10.9.2 (Mavericks) and we have networked HP Color LaserJet CM2320nf MFP. I have been successful to set up printer with computer but has not been able to set up a scanner. As far as I remember while I configured in windows there was PCL at

  • Deploying in-house Apps

    A client of mine wants to produce their technical docs catalogue as an iphone app for their sales reps and third-party designers to use whilst on-site. Due to this being simply for in-house purposes it wouldnt be viable for submission to the AppStore

  • SOAP web-activity workflow step

    Hello, I want to start a function of an external application via ECC6 SOAP-message. The generated XML should look like this: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope     xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"     xmlns