Mildinsick.com

Delivering Innovation

Do you want an original way to tell your loved one that you love them this Valentine’s Day? Why not send them a workbook with a popup message? When her partner opens the workbook, she will see a message telling her her true feelings.

Is that how it works:

1) Create an Excel workbook.

2) Press ALT + F11 to enter the Visual Basic code editor.

3) On the left side of the code editor, you will see the Project Explorer (if you can’t see it, press CTRL + R to open it).

4) You should see the name of the workbook on the left, with Sheet1, sheet2, sheet3 and This workbook under it. Double click on This workbook to attach code to one of the events in the life of the book (in this case, what happens when you open it).

5) You will see two dropdown arrows at the top of the code window. Click on the one on the left (it currently says General) and choose Work book instead (the only other possible option).

6) Now you can see the following code:

private subworkbook_Open()

finish sub

Between these two lines of code, type a command to display a message. Something like this would do:

MsgBox “I love you!”

For a slightly more impressive system, ask your loved one to be your Valentine:

private subworkbook_Open()

dim answer always

Response = MsgBox(“Will you be my Valentine?”, vbQuestion + vbYesNo, “Valentine’s Day”)

If Answer = vbYes Then

MsgBox “Then I’ll be yours!”, vbExclamation + vbOKOnly

The rest

MsgBox “Oh…”, vbExclamation + vbOKOnly

It will end if

finish sub

Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *