简体   繁体   中英

Permission denied: 'Msgbox'

I am using VBA to create message boxes with Yes/No responses. For one in particular, the message box works fine but any message box I put after this one results in a Permission denied: 'Msgbox" error. My code looks something like this:

if msgbox ("Release this Assessment to the Team Leader?", vbyesno) = vbyes then
   msgbox "Released"
   else
   msgbox "Not released"
end if

So I get the first message box but for either selection (Yes or No) I get the error message. Any idea what may be causing this?

Try this instead:

msgBox ("Release this Assessment to the Team Leader?", vbyesno)
select Case msgBox
    Case "Yes":
        msgBox "Released", vbokonly
    Case "No":
        msgBox "Not released, vbokonly
End Select

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM