View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bruce Bruce is offline
external usenet poster
 
Posts: 138
Default Help accessing msgbox prompt via function

Hi,

In my ProSheets macro I wish to call myMsgbox function and return the
response back to my Prosheets macro so it does an action if = Yes or another
action if = no.

I'm almost there but can't crack the last part.

Bruce

Sub ProSheets()
myMSG = "Do you want to protect worksheets?"
myMsgbox (myMSG)

'If Yes then do this
'Else if No then do that
End Sub

Function myMsgbox(myMessage As String)
msg = myMessage
Style = vbYesNo + vbCritical + vbDefaultButton2
Response = MsgBox(msg, Style)
If Response = vbYes Then
myMsgbox = "Yes"
Else
myMsgbox = "No"
End
End If
End Function