Microsoft Excel - Alert Message - Asked By prakash on 02-Dec-13 05:36 AM

As soon as i open my Excel i want to get message like "welcome" for an ex: message like "ok" if we click that then only we can continue to next process in the same way i need to wrong macro


Harry Boughen replied to prakash on 02-Dec-13 02:12 PM
Hello Prakash,
Enter this code by opening VBA, right click on This Workbook.  In the window that opens, in the top left drop down select Workbook.  This will create the Private Sub/End Sub part.  Put in the rest and adjust the strings and any code that you require in the commented parts of the if statements.

Option Explicit

Private Sub Workbook_Open()

Dim iRet As Integer

iRet = MsgBox("Welcome", vbOKCancel, "MyExcelSpreadsheet")

If iRet = vbNo Then
    'do one thing
Else
    'do another thing
End If

End Sub

You have to save and re-open the spreadsheet for the macro to run.

Regards
Harry