Description: My macro: ``` Sub Message_Box_Test dim iResponse as Integer dim strNotes as String iResponse = MsgBox("Are there special notes that need to be added to this report?", Buttons = YESNOCANCEL, "Special Notes") If iResponse = 7 Then MsgBox "No" ELSEIF iResponse = 2 Then Exit Sub ELSE strNotes = inputBox("Enter the special notes as they should appear:", "Special Notes") END IF msgBox strNotes End Sub``` When I run it, the first message box has the correct title, but only an OK button. Steps to Reproduce: 1.Run the macro in the description (between the ```'s). Actual Results: The first message box has only one button Expected Results: It should have three buttons, yes, no, and cancel Reproducible: Always User Profile Reset: No Additional Info: Version 7.0.6.2(x64) Build 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b 4 threads VCL:win en-US Calc: threaded I'm somewhat annoyed that I couldn't highlight the information in the About window to copy and paste here.
I believe this report should be marked NOTABUG or INVALID. Correct code would be like the following. =========================== Option Explicit Option VBASupport 1 ' without this line vbYesNoCancel is not defined. Sub Message_Box_Test dim iResponse as Integer dim strNotes as String ' Correct Enum member would be vbYesNoCancel, not YESNOCANCEL ' Also, I added colon to indicate named parameter. iResponse = MsgBox("Are there special notes that need to be added to this report?", Buttons:= vbYesNoCancel, "Special Notes") If iResponse = 7 Then MsgBox "No" ELSEIF iResponse = 2 Then Exit Sub ELSE strNotes = inputBox("Enter the special notes as they should appear:", "Special Notes") END IF msgBox strNotes End Sub
"I'm somewhat annoyed that I couldn't highlight the information in the About window to copy and paste here" Additionally, there is a button on the About window that copies the information needed to the clipboard.
Reading this https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03010102.html you should rather use: iResponse = MsgBox("Are there special notes that need to be added to this report?", MB_YESNOCANCEL, "Special Notes") Could you give it a try? BTW, there's an error in the documentation, it's not MB_ABORTRETRYCANCEL but MB_ABORTRETRYIGNORE
1. Honestly Speaking, I still haven't found the mechanism with which our Runtime makes the enum members in ooo.vba.VbMsgBoxStyle. 2. Secondly, though we can access MB_YESNOCANCEL IN STARBASIC https://opengrok.libreoffice.org/xref/core/basic/source/runtime/stdobj.cxx?r=0d563373#584 but not in MS-VBA because the constant comes from winuser.h, which is for C++, not for MS-VBA. https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
Olivier: I put you in cc of the other bugtracker but since I created another bugtracker for the doc part, don't hesitate to uncc yourself. Mike: thought you might have some opinion here.
(In reply to Julien Nabet from comment #5) > Mike: thought you might have some opinion here. I'm sorry, I don't quite see on which question my opinion is needed. There's a user error of using non-declared/defined variable YESNOCANCEL, which evaluates to 0 when used without Option Explicit. There's a (unrelated) wrong entry in help, already fixed by you in bug 146299 :) There's some misunderstanding mentioned in comment 4, but I don't quite see what is wanted there. There's also a bug (IMO) related to enums not fully supported in Option Compatible - see bug 145753 comment 3. But that is outside of scope of this.
(In reply to Mike Kaganski from comment #6) > (In reply to Julien Nabet from comment #5) > > Mike: thought you might have some opinion here. > > I'm sorry, I don't quite see on which question my opinion is needed. > > There's a user error of using non-declared/defined variable YESNOCANCEL, > which evaluates to 0 when used without Option Explicit. > > There's a (unrelated) wrong entry in help, already fixed by you in bug > 146299 :) > > There's some misunderstanding mentioned in comment 4, but I don't quite see > what is wanted there. > > There's also a bug (IMO) related to enums not fully supported in Option > Compatible - see bug 145753 comment 3. But that is outside of scope of this. Ok I hadn't read comment 1 from Himajin100000. So there are 2 ways to provide the option: - MB_ABORTRETRYIGNORE when no VBASupport or VBASupport = 0 - Buttons:= vbYesNoCancel when VBASupport = 1 About the comment 3, I don't know. Sorry for the noise then.