how do i create a dialog box to appear on opening an excel wkbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a dialog box that appears on opening an excel workbook along
the lines of "this workbook contains terminated contracts, do you wish to
proceed?". I have seen dialog boxes on workbooks before but do not know how
to create them myself.
 
lallyboo said:
I want to create a dialog box that appears on opening an excel workbook
along
the lines of "this workbook contains terminated contracts, do you wish to
proceed?". I have seen dialog boxes on workbooks before but do not know
how
to create them myself.

Open the workbook and go to the VBA editor (Alt-F11). Click on the "Project
Explorer" icon and select "ThisWorkbook".

At the top of the right hand pane, left side, select "Workbook" from the
drop down list.
At the top of the right hand pane, right side, Select "Open" from the drop
down list.

Put this code in the Workbook_Open event (right hand pane) of the workbook:

Private Sub Workbook_Open()

Dim strResponse As String

strResponse = InputBox("This workbook contains terminated contracts, do
you wish to proceed?", "Input", "N")
If UCase(strResponse) <> "Y" Then
Application.Quit
End If

End Sub

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top