-
Solved: msgbox problems
I continue to struggle with vba excel on my mac.
Among many issues this one is currently taxing me
[vba]Dim result As VbMsgBoxResult[/vba]
seems to throw up an automation not supported error as does any attempt to dim other msgbox attributes.
Do I take it that I can't do it?
the full code, which is fine on a pc, is below.
Any clues?
[vba]Dim strMessage, strTitle As String
Dim style As VbMsgBoxStyle
Dim result As VbMsgBoxResult
datecompare = Format(ActiveCell.Value, "d-mmm-yy")
If datecompare = txtDate.Value Then
strMessage = "You have already entered this date once. Do you wish to enter this date again?"
strTitle = "Repeated date message"
style = vbYesNo + vbExclamation + vbDefaultButton2
result = MsgBox(strMessage, style, strTitle)
If result = vbNo Then 'takes you back to menu sheet
Worksheets("Menu").Select
End
End If[/vba]
Last edited by BlueCactus; 06-29-2005 at 08:11 AM.
Reason: Added VBA tags to code
-
I don't have a clue, but I was wondering if you had tried declaring them as variants as a (possibly temporary) workaround?
-
Howdy, Slim, and welcome to VBAX.
I won't have access to my Mac for another 12 hours (something about work, and all that!), but I'll check for you then, if no one else comes up with a solution.
Software: LibreOffice 3.3 on Mac OS X 10.6.5
(retired Excel 2003 user, 3.28.2008 )
Humanware: Older than dirt
--------------------
old, slow, and confused
but at least I'm inconsistent!
Rich
-
Not that I've ever used VBA on a Mac, but I'm assuming some similarity in terms of how the MsgBox function works...
MsgBox returns an Integer, so you'll need:
Dim result As Integer
This returned integer is going to be a known value, so they are assigned as constants within VB - you can use the vbconstant or the integer value, depending on what mood you're in:
vbOK 1
vbCancel 2
vbAbort 3
vbRetry 4
vbIgnore 5
vbYes 6
vbNo 7
Likewise, the messagebox style parameter is a numeric expression. You can use the vbconstants (or their actual values) so for your code to work as is, just declare "result" as an integer as well
K :-)
-
Many thanks that got it! Working fine now. Good work folks.
-
Cool, happy to help
I've marked the thread as solved
K :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules