MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Message Box for specific excel file

  Asked By: Luane    Date: Jan 11    Category: MS Office    Views: 1559

I am a newbie and I would like to know how can I make a message box
appear with a message saying "hello" each time a specific Excel
workbook will be open. I know I have to do it in Vb, but where do I
enter the code?
Start with pressing ALT + F11 to bring up the VB screen ?



2 Answers Found

Answer #1    Answered By: Aaron Evans     Answered On: Jan 11

OK, you've opened the VBE. In the left pane look for:
VBA Project(YourSpreadsheetName)
and drill down until you see its 'This Workbook'. Right-click on this
and choose 'View Code'.
In the new (blank?) area that appears, there should be 2 dropdown
lists at the top, in the left dropdown choose 'Workbook', and if the
right dropdown doesn't already show 'Open', choose it there. The
flashing cursor should now be sitting somewhere inbetween
'Private Sub Workbook_Open()'
'End Sub'

Paste the following code there:
msgbox "hello"

Close the VB Editor, save close the workbook, and then open  it again. QED.

Answer #2    Answered By: Salvatore Kelly     Answered On: Jan 11

In VBE duoble click on Thisworkbook (in project explorer window)
and copy this code

Private Sub Workbook_Open()
MsgBox "Helooo"
End Sub

Didn't find what you were looking for? Find more on Message Box for specific excel file Or get search suggestion and latest updates.